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

dww’s picture

Issue summary:View changes

added section on implementation details

dww’s picture

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.

klonos’s picture

[clicking on the imaginary follow button] ;)

dww’s picture

Assigned:Unassigned» dww
Status:Active» Needs review
StatusFileSize
new1.35 KB

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?

dww’s picture

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

kyle_mathews’s picture

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.

dww’s picture

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

dasjo’s picture

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 :)

dww’s picture

@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]...

dixon_’s picture

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 :)

dww’s picture

@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.

dasjo’s picture

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

Fabianx’s picture

@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

RobLoach’s picture

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.

jhedstrom’s picture

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.

Jackinloadup’s picture

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.

wizonesolutions’s picture

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

Dane Powell’s picture

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.

yannickoo’s picture

yannickoo’s picture

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

dww’s picture

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

yannickoo’s picture

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

dww’s picture

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).

jhedstrom’s picture

StatusFileSize
new1.76 KB

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.

webchick’s picture

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.

kyle_mathews’s picture

StatusFileSize
new1.77 KB

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.

klonos’s picture

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.

mgifford’s picture

Nice addition @klonos

oadaeh’s picture

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

tvn’s picture

StatusFileSize
new9.22 KB
new8.72 KB

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 greenFollowers 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.

bryancasler’s picture

Grey looks better to me.

Dane Powell’s picture

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!

klonos’s picture

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

tvn’s picture

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

klonos’s picture

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

MustangGB’s picture

Perhaps use #66666 as the grey colour then

lisarex’s picture

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.

webchick’s picture

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.

tvn’s picture

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

yannickoo’s picture

@webchick

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

...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.

webchick’s picture

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

tvn’s picture

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

cweagans’s picture

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.

MustangGB’s picture

Yay for being helpful =D

jhedstrom’s picture

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.

klonos’s picture

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.

dddave’s picture

Yes please!

klonos’s picture

Status:Needs review» Reviewed & tested by the community

RTBC then(?)

Bojhan’s picture

Looking good!

AlanO’s picture

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

Dane Powell’s picture

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...

naught101’s picture

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?

AlanO’s picture

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.

webchick’s picture

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.

AlanO’s picture

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

naught101’s picture

Status:Needs review» Reviewed & tested by the community

@webchick: see #25 :)

klonos’s picture

...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: Help Maintainers Manage Issue Priority by Encouraging Voting

Gábor Hojtsy’s picture

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.)

grendzy’s picture

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?

yannickoo’s picture

drupal:drupal

webchick’s picture

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

dww’s picture

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. :/

dww’s picture

Status:Needs work» Needs review
StatusFileSize
new2.33 KB

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...

dww’s picture

StatusFileSize
new2.23 KB

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.

dww’s picture

StatusFileSize
new2.23 KB

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.

dww’s picture

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.

klonos’s picture

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?

dww’s picture

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. ;)

klonos’s picture

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 ;)

dww’s picture

klonos’s picture

Yep, that's the one.

dww’s picture

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. ;)

dww’s picture

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.

Michelle’s picture

Awesome! Great job!

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

arlinsandbulte’s picture

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

klonos’s picture

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

tvn’s picture

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.

juan_g’s picture

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. :)

justindodge’s picture

Awesome!! Nice work.

yannickoo’s picture

Finally <3

webchick’s picture

SilviaT’s picture

Great work!

naught101’s picture

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.

justindodge’s picture

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

I agree.

dww’s picture

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

MustangGB’s picture

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

klonos’s picture

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

dww’s picture

@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

klonos’s picture

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.

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

Anonymous’s picture

Issue summary:View changes

moved all the details about the page listing followers over to #1304558 and fleshed out implementation details here