Download & Extend

Display count of issue followers when viewing an issue

Project:Project issue tracking
Version:6.x-1.x-dev
Component:Issues
Category:feature request
Priority:normal
Assigned:dww
Status:closed (fixed)
Issue tags:Developer improvements, Drupal.org priority, flag integration, prairie

Issue Summary

Once #34496: [meta] Add Flag module to allow users to subscribe/unsubscribe without posting a comment is done, it would be nice to display a count of followers when you're viewing an issue. Probably a small "N followers" counter under the "Follow" button. Once #1304558: Provide a page showing all the users following a given issue is done the counter would itself be a link to that page.

Implementation details

flag.module makes this very easy since it maintains a table of {flag_counts}, so it's a very trivial indexed query to get this information. There's almost certainly a clean API for getting this info, I just didn't look it up yet.

Displaying this should be a quite trivial patch to theme/project-issue-summary.tpl.php and template_preprocess_project_issue_summary() from includes/issue_node_view.inc.

Comments

#1

I just edited the summary:
- Moved discussion of the page listing all the followers over to #1304558: Provide a page showing all the users following a given issue.
- Started to flesh out implementation plans.

This should be quite easy if anyone wants to work on a patch.

#2

[clicking on the imaginary follow button] ;)

#3

Assigned to:Anonymous» dww
Status:active» needs review

Okay, this is basically working. However:

A) There's no CSS to make this look nice (e.g. centered under the follow button, smaller, light grey, etc.

B) This count isn't automatically updated via AJAX when you click to "Follow" or "Unfollow". I.e. it's just a static count that was true at the time the page was loaded, and not updated if you happen to change the state.

We probably could get the AJAX working to update this, but ugh, that's a lot more work. Do we care?

AttachmentSize
1304550-3.issue-follower-count.patch 1.35 KB

#4

p.s. Now deployed on http://subscribe-drupal.redesign.devdrupal.org if anyone wants to play along at home.

#5

Great start. Though it looks a bit plain and lost w/o any styling.

It'd probably make sense to add this to the Issues table. Especially on core or other big projects, it'd be useful to sort by # of subscribers to see which issues have momentum.

#6

Yeah, I agree the styling needs help -- that's what I said in #3.A. ;)

For performance reasons, nnewton is going to kill me if we put this as a sortable column on the issue queue views. Sorry, that's just going to have to wait until the issue queues are powered by solr or something. And yeah, that's for a separate issue, not here. I'm just talking about displaying this info when you're viewing an issue node itself.

Cheers,
-Derek

#7

in addition to showing the count as a number we could even have a small chart indicating how the number of subscribers developed over time :)

#8

@dasjo: Interesting idea, but I think that's too much visual noise on the issue itself. However, that might be something to consider over at [ #1304558]...

#9

Regarding the AJAX update of the follower count; wouldn't that be automagically solved if we instead put the follower count as a part of the button theme/template? The button is updated through AJAX when clicked, so the follower count will be updated too.

This is at least how I usually solve the problem with Flag and flag counts :)

#10

@dixon_: yeah I tried that but unless it's actually part of the <a> itself it doesn't get replaced. It'd be nice if flag provided a div that gets replaced so you could easily do this kind of thing, but at this point that doesn't seem to be the case. I think it'd be weird if the count was inside the button itself, and that'd make it impossible for it to link to the page of followers. I probably should have mentioned all this once I tried it. ;)

That said, I could be wrong and maybe someone with more front-end fu could get this working outside the <a> without any custom JS.

#11

@dww i think it would be helpful especially for noisy issues. created #1307540: Provide charts that visualize issue activity over time

#12

@dww: I might be wrong and it is not possible in this flag version, but in another site we solved this using:

This post has been added to your bookmarks (Total: [flag-bookmark-count])
as "FLAGGED MESSAGE" and "UNFLAGGED_MESSAGE".

Together with some little CSS and changing the flag.tpl.php to unshow the normal count (to not show the count twice) it seems that is all that is needed to update the count on "flag" or "unflag".

Hope that helps and nice effort!

Best Wishes,

Fabian

#13

This would be nice... Subscribe comments were telling of what issues were important, but those aren't around anymore (thankfully). Would be nice to get the follower count on issues.

#14

Is the AJAX updating of the counter even strictly necessary? It seems that we could a) do nothing (a page refresh would pull the updated count), or b) add a js function to manually increment the flag count number by one on the page (w/o a page callback) on successful flagging.

#15

I agree with #14 about not updating the subscriber count with AJAX as dww asked in #3. It seems like a lot of unnecessary work and server load for very little real world necessity. I think simply client-side incrementing the number would be sufficient for d.o's use-case if this functionality is desired.

#16

I agree; just get it out there first and then improve it. Subscriber counts would be awesome to see.

#17

Agreed, let's just get a working version out- anything is better than nothing. Once we see how it actually works in practice, we can worry about refining it.

#18

#19

@dww your link is dead where can I find the deployment site?

#20

Sadly, we were short on disk space on the machine where the development VMs live, so I had to kill that site. Maybe we've got enough space that we can make a new one for follow-up fixes and improvements like this, and we can deploy the patch again.

Meanwhile, interested parties can start with http://drupal.org/project/drupalorg_testing and probably get things working. Although, ugh, we never resolved #1231786: Add flag module to profile so that profile doesn't know about flag and how it's configured here on d.o. :( The good news is it's not that hard to do so (just deploy flag and turn it on and project_issue should mostly do the right thing itself). Anyone interested in helping is welcome to meet me over at #1231786.

Thanks,
-Derek

#21

I think it's more important to solve this issue here. I'm really interested how many users are following an issue.

#22

Yes, and I'm explaining how people can help resolve this issue...

We don't just Try Stuff(tm) on the live site. We develop, test, review, stage, etc, and when everything is cool, we deploy. Since we still don't have a fully automated dev -> staging -> live workflow for d.o, we have to do a little more work each time. However, as much as possible, we automate as we go. So, instead of me just helping people manually setup a local dev environment for this, I'm encouraging that effort to go into fixing the automated local dev environment (the drupalorg_testing profile).

#23

Here's a patch that adds the current count via flag_get_counts() in the project issue node template. It then binds a reaction to the Flag module's flagGlobalAfterLinkUpdate trigger, and either adds 1 or subtracts 1 from the current count via javascript.

AttachmentSize
project_issue-1304550-23.patch 1.76 KB

#24

I deployed that patch to http://webchick-drupal.redesign.devdrupal.org/ (Apache user: drupal/drupal, then Drupal user: bananas/bananas)

Flag counter on d.o

Looks great, and automatically increments/decrements as you click "Follow/Unfollow".

Don't have time for a code review atm, hopefully someone else can take care of that.

#25

Did a brief code review.

Made two minor changes. String comparisons should use the stricter === equality operator. And for parseInt(), it's safer to always specify the radix, as strings starting with 0 are interpreted as octal.

Also, this could use a bit of css massaging. It could use some extra spacing it seems.

Otherwise, looks great! Excited to see this coming together.

AttachmentSize
project_issue-1304550-23.patch 1.77 KB

#26

Really great!

How about "x people following this issue" / "x people following this issue (including you)" as the text depending on whether user is already following or not.

#27

Nice addition @klonos

#28

@klonos: it seems to me that the state of the button would make that text redundant.

#29

klonos's suggestion on the text is good, but too long, I'd just make it "x followers" and move a bit. I'd also change colour to either green or grey depending how important we want this information to seem on the page.

Followers count green
Followers count grey

the css for the above images:

.project-issue-follow-count {
color: #96BC44; /*or #9d9d93 for grey*/
margin-top: 10px;
text-align: center;
width: 8.2em;
}

On the side note: is there any reason for "Jump to" links to be black? Maybe we could colour them also while we are at it? :) Personally I found out they are links after being over a year on d.o., never even looked on them earlier.

AttachmentSize
followers-count-green.png 8.72 KB
followers-count-grey.png 9.22 KB

#30

Grey looks better to me.

#31

I also think grey is better- green makes it seem like it's a link that can be clicked, which is not yet the case.

Very excited to see this go live soon!

#32

Yep, I like the "x followers" too. Why either green or gray though and not simply black?

#33

To differentiate it from the plain issue text and static issue summary table text.

#34

Ah yes, that makes sense. Same as the "Posted by ... on ... at ..." info of comments.

#35

Perhaps use #66666 as the grey colour then

#36

The 2nd example with the # of followers in grey is looking good!

@tvn, yes, if someone could make the 'Jump to' links look like links, that would be great.

#37

If someone can get me a chunk of CSS to copy/paste from Firebug or whatever, I'd be happy to add that to the demo site.

#38

@webchick, there is css in my comment #29. or do you need something else?

#39

@webchick

.project-issue-follow-count {
  color: #96BC44; /*or #9d9d93 for grey*/
  margin-top: 10px;
  text-align: center;
  width: 8.2em;
}

#40

...we said that for gray perhaps we'd better use #666666 - same as the "Posted by ..." info of comments. Perhaps give #555555 a spin - same as h1/h2/h3 headings.

#41

Ok, please bikeshed the colour and then tell me what to put. ;)

#42

Well the grey on images was from D.o. style guide http://drupal.org/node/1051644. I guess we can just go with #666666.

#43

Per https://infrastructure.drupal.org/drupal.org-style-guide/colour.html, our choices are either #9d9d93 (Grey) or #53b0eb (Light blue). Seeing that all of the places where we use Light blue are links, I think it's narrowed down to #9d9d93. However, we don't use #9d9d93 anywhere that I can see. Instead, implementers chose to use the darker #666, so let's go with that.

#44

Yay for being helpful =D

#45

This seems to have stalled out on design discussions. I'm pretty sure those changes will actually need to go into the Blue Cheese theme, rather than into this module.

#46

Yeah, can we please roll this. People seem to still post "subscribe" comments despite the existence of the "Follow" button simply because they need a way to tell maintainers there's interest in the issue.

@webchick: Hey Angie, even if you feel there is still debate about the color, we can simply roll this with whatever color you choose and then file a separate issue on changing the color (perhaps in the Blue Cheese theme's issue queue as Jonathan suggests)? Thanx in advance.

#47

Yes please!

#48

Status:needs review» reviewed & tested by the community

RTBC then(?)

#50

Looking good!

#51

Please put this up already. People post "subscribe" in comments to get maintainers attention is getting on peoples nerves apparently http://drupal.org/node/1054326#comment-5462844

And it's still going on.

http://drupal.org/node/1054326#comment-5503462

#52

Indeed- what's the holdup with this? It's such a waste to have this all ready to go, and to just be sitting in the queue for no apparent reason...

#53

Wow, as if subscribe comments aren't bad enough, now we have people just whingeing and making demands, and adding no new information, and not offering to help out.

Perhaps it's more work than you think, and the people already working on it have other responsibilities to attend to?

#54

It shouldn't be wrong to demand/ask/whine as to why this issue hasn't been fixed yet. The issue, as far as I know, is completely fixed. So, why hasn't it been implemented yet? The issue has been assigned to someone. I don't care if they volunteered or not, it's their responsibility to fix the issue. It's fixed...so what's the hold up? The design style shouldn't be discussed here as suggested by jhedstrom, it should be its own issue. So put this up already...please.

#55

Status:reviewed & tested by the community» needs review

Just a note that this sort of attitude is exactly the worst way to convince a community volunteer to work on things that you think are important. It is, however, one of the very best ways to get them to go find something else actually fun/rewarding to do with their time, and/or to stop contributing to the project altogether.

Please read http://drupal.org/dcoc and take it to heart. Thanks.

Can someone confirm they did a code review of the patch in #23? I see a lot of +1s but not a lot of the kind of comments that lead to changes being deployed on Drupal.org.

#56

You're right, I'm sorry about the attitude. Thanks for the link.

#57

Status:needs review» reviewed & tested by the community

@webchick: see #25 :)

#58

...I was about to link to that post too. I think that we were left at a "bikeshedding" stage (#41) about trivial matters such as the exact color and wording the text should have. We can go with #666666 (see #43) and "x followers" for the text. If people think they should be changed, we can do it in separate, successive issue(s). This one was about displaying the number of followers and AFAICT the code for that is pretty solid. So let's roll this to stop the "stop subscribing" comments and the "I want maintainers to know there's interest" replies, shall we?

PS: ...related: #42232: Allow voting on issue priority - Death to "+1" comments

#59

Subscribe!

(I mean I'd need this functionality to be able to tell how many people experience certain issues after a D6 release like the three known issues we have now at http://drupal.org/drupal-7.12#known-issues. It would be an important data point to tell whether we should do a quick followup release or not. Now that we don't have subscribe comments, its much harder to tell how many people experienced the issue or held off updating due to it.)

#60

Is the patch still applied on http://webchick-drupal.redesign.devdrupal.org/ ? I couldn't log in with the bananas/bananas password. Is the follow count expected to be visible for anonymous users?

#61

drupal:drupal

#62

Shoot. Yeah, I re-imaged my dev server since then. I'll try to remember to patch it again later tonight.

#63

Status:reviewed & tested by the community» needs work

- #23 doesn't actually implement the UI from #29 that everyone seems to like.
- I don't mind putting the CSS for this in project_issue.css and letting themes override it if they want.

I'm going to try re-rolling to implement #29. Stay tuned.

Also, bummer -- I can't just deploy this since it changes CSS and JS and therefore we need to clear the varnish cache when this goes live and I don't have powers to do so. :/

#64

Status:needs work» needs review

Slightly ugly, but it works. ;)

Alternatively, I guess we could inject the raw count via drupal_add_js() as a setting and then use that. Might be cleaner/clearer...

AttachmentSize
1304550-64.issue-follower-count.patch 2.33 KB

#65

Yeah, this doesn't work, but I don't really know why. Once again, I knew enough jQuery to be dangerous, but not much more. ;) I'll probably just go with #64 unless someone wants to give me a clue bat.

AttachmentSize
1304550-65.issue-follower-count.patch 2.23 KB

#66

Sorry, I'm an idiot. ;) Even *I* could figure out that this:

Drupal.settings.project_issue.follower_count - 1;

Doesn't change the value of that setting. ;)

This is now working, and IMHO cleaner than #64.

AttachmentSize
1304550-66.issue-follower-count.patch 2.23 KB

#67

Status:needs review» fixed
Issue tags:+needs drupal.org deployment

Okay, committed and pushed #66. Tagging for deployment since I can't actually do this myself due to the JS/CSS changes (side note: that really needs to be a jenkins job or something so that nnewton or `basic don't have to be personally involved in issues like this).

p.s. @webchick and @naught101: thanks for your supportive help in here. @AlanO: thanks for apologizing about your initially crappy attitude. I only have about 1000 different responsibilities around here, and webchick was exactly right -- comments like yours make me just go find one of the other 999 things I could be doing instead of appeasing people who are making self-righteous demands on my unpaid time.

#68

Is there an issue in the webmasters/infrastructure queue for deploying this? Should we switch this issue there? I mean do the right people get notified simply by tagging this?

#69

I'm the right people. I just have to find nnewton or 'basic in IRC on Monday, too. This has to be coordinated. Don't worry, I've been maintaining d.o for over 5 years, I know how it works. ;)

#70

I'm the right people...

...yeah sorry, at some time in the past stumbled upon an organizational chart of drupal.org staff somewhere. Pretty nice too with photos and all! Since then I simply forgot what each person's role was/is - I only remember your nicks & names ;)

#71

#72

Yep, that's the one.

#73

Whoot, deployed! I ended up spending the time to automated the varnish crap so we don't have to block on nnewton in the future. See #1477994: Create jenkins job for clearing the varnish cache when deploying CSS/JS changes

69 followers on this issue will see this in their tracker. ;)

#74

Hrm, although -- does it make sense to show the follower count for anon users? That's currently happening, and probably okay, but I just thought I'd ask.

#75

Awesome! Great job!

I think it makes sense to show for anon users as long as it's not a resource issue.

#76

SWEET, this is great!
As a follow-up idea, I created this issue: #1479520: Add # of followers to issue queue column lists

#77

Perfect! Thanx Derek & everyone that worked to make this happen. If we're doing such a great job on making d.o rock while still in D6, imagine what we'll be able to do when in D7 or D8 ;)

PS: I really like #1479520: Add # of followers to issue queue column lists ...going there to follow and see the counter get updated :D

#78

Great! Thanks dww!

Follow count does look a bit strange for anon users without follow button, I'd not show it. But only if it's not too much work to hide it, otherwise not important.

#79

Good work, follower count is one of the factors that can help prioritize issues (although of course there are also many very important issues with few followers).

That'd be http://drupal.org/node/1206660 ;)

And they (infrastructure team) are also at How YOU (yes, you!) can help make Drupal.org awesome. :)

#80

Awesome!! Nice work.

#81

Finally <3

#82

#83

Great work!

#84

Follow count for logged out users is still useful. That way if someone with only one drupal problem finds the right issue, they can see that it's got lots of followers, and therefore (hopefully) has the attention of the developers, and is being worked on.

#85

Follow count for logged out users is still useful. ...

I agree.

#86

Great. I'm happy to leave it. In that case...
RFC: #1487286: Display a "Login or register to follow" link for anonymous users
(reply there, not here)

Thanks,
-Derek

#87

It seems a consensus has already been reached but just thought I'd give another +1 for showing followers to anonymous users

#88

@akamustang: this issue here is fixed. You can +1 over at #1487286: Display a "Login or register to follow" link for anonymous users

#89

@klonos: akamustang is acknowledging that we already made the decision but saying he supports the conclusion we reached to leave the follower count (what this issue is about) visible even for anonymous users. That's not the same as +1ing the proposal to *also* display a login/register link to anon users in place of the follow button (which is what #1487286 is about).

Cheers,
-Derek

#90

Ah, yes. I just was under the impression that the other issue was implying that in order to display the number of followers to anonymous we'd have to implement a way to allow them to follow first. Sorry.

#91

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.