We need to port all the native support in project_issue that integrates with flag.module to provide the ability to follow issues without commenting on them.

My primary concern is that getting this working in a performant way on Drupal.org required patches to tracker2. See #404084: Add support for tracking flagged nodes for more. However, tracker2 is now part of D7 core, so we're obviously not going to be able to do the same things. :/ So, we need to figure out how to make this work given D7 core only and no help from tracker2. Or *maybe* we could get a fix into the core tracker for this, but I *HIGHLY* doubt it. :( Perhaps we'll have to try to do what tracker2 is doing in D6 directly from inside project_issue?

----

This issue resulted in the creation of the flag_tracker module in contrib. However, there are a few remaining pieces to actually getting this working on the upgraded D7 d.o site:

#1828620: Enable and properly configure flag_tracker during D7 update/migration
#1828634: drupalorg_update_7006() ignores issue following and flag_tracker
#1706520: Add a "Follow" button to the issue metadata block
#1828652: Theme the "Follow" button in the issue metadata block

There's a major bug in flag_tracker:
#1828658: Nodes are not auto-flagged when added to the tracker

And we've got a pretty major bug in the issue views:
#1828756: D7 views don't honor tracker and issue following

Finally, there are also some minor cleanup issues in the flag_tracker queue:
#1828562: Flag tracker settings on a given node type should only allow flags that can touch that node type
#1828568: Minor code style bugs in flag_tracker.module

Comments

mirzu’s picture

Assigned: Unassigned » mirzu

I started looking at this and I think there are a couple of approaches that we could use to solve this issue.

  1. Port the current patch mentioned above to tracker in d7
  2. Create a new contrib module that provides the generic user tracker functionality above
  3. Use the existing: subscriptions module

Option 1 Update the tracker module like tracker2 was updated. Advantage: Simple, the diff is ready, just needs to be applied to the d7 module. Disadvantage: need to change a core module.

Option 2 is simpler to accomplish, but could be a little harder to code cleanly. Mainly because it would require the use of "internal" functions from tracker. that could be solved by a) ignoring that they are internal functions and just use them. b) create wrappers that are not internal.

The integration with the issue module would be nearly identical for both options 1 and 2.

Option 3 Create a "flag interface" that allows users to subscribe and unsubscribe from nodes using flag and subscriptions. The module seams like it would handle the mechanics of subscription, but would require an additional module for custom emails, and would likely bring with it a number of new options and workflow decisions. I don't know enough about this module to assess it's feasibility.

Integration would likely need to be rethought.

dww’s picture

Thanks for looking into this!

While we're exploring options, there's also:

4) The whole notifications/messaging framework.

5) Trying to replicate this stuff with just flag and rules.

My primary criteria for making a decision on which approach to pursue would be:

A) Can we replicate the current functionality without many (if any) end-user-visible changes in behavior?
B) What are the longer-term maintenance implications?
C) How feasible is a timely implementation?
D) How well does it fit into the overall strategy of keeping project_issue itself as small as can be with as little hard-coded custom stuff as possible?

I think that's the priority order I'd have to put those criteria in. I'm not sure how to rank each of the options with these criteria -- I don't have enough data without doing more research myself.

From the d.o-side, generally, I think keeping this flag-based will be easiest from the infra team's perspective, but I could be wrong. I'm just hesitant to introduce a new dependency on a large external project if we're not already using it for other things. Flag is already being used by things outside of Project*. And I suspect doing some custom (if slightly generalized) email notification stuff to keep all the existing functionality working the same way will be the quickest path. But, again, without more data about each of the options, it's hard to commit to a specific approach just yet. Also, there's no telling what we'd end up using rules for on d.o if we made it a requirement for Project*. ;) So, it's definitely worth investigating that approach, too.

Thanks,
-Derek

mirzu’s picture

4) I've had bad experiences with this framework on the D6 side, and it wasn't entirely positive, and I've recieved similar feedback from others. It was difficult to work with and buggy. The drupal 7 version is in Alpha so I'm skeptical that it's mature enough either.

5) I'll poke at rules today, and get back to you. I'm curious about performance, but it might not be an issue.

I'm with you 100% on the priorities.

I'd like to see a generic flag_tracker solution for d7. I think it's a no brainer useful module, unless you don't "need" a module and can do this with flag + rules (in a performant fashion). More after I've discovered more with this solution.

dww’s picture

If we end up sticking with our own custom email sending code, see #1571404: Make the 'Reply-to address on e-mail notifications' setting (project_issue_reply_to) per-node-type.

However, here's another issue that might be solved via rules: #1571400: Port auto-closing functionality to D7

dww’s picture

Also, yeah, I don't think messaging/notifications is actually a good idea, but I wanted to mention it for completeness. ;)

Otherwise, sounds like you're on the right track, so just keep at it...

Thanks!
-Derek

senpai’s picture

Issue tags: +sprint 1, +sprint 2

Tagging.

dww’s picture

We had a discussion about Rules + Project* in IRC today with Itangalo, mikey_p, davereid, jhodgdon, and myself. Turns out that implementing our existing email notification logic with Rules would require quite a lot of custom actions in project_issue. So, in terms of removing custom code, this wouldn't help. And the resulting rules would be so specific that they'd probably break if you changed anything -- which invalidates one of the other reasons to use Rules.

Itangalo suggested that maybe project_issue should still do all the fancy logic it does now to figure out who should be emailed, and just expose that to rules, and then use rules to actually send the emails. Except, there's no good support for rules to deal with queues (which we want for the notification emails). Basically, that would amount to doing all the "hard" stuff in project_issue, and then the trivial part in Rules. A 164Kb (compressed) external dependency and lots of complication in the call stack hardly seems worth it for this.

Sure, we could perhaps expose some of this to Rules for other sites that optionally want to make use of Rules for more fancy things, but this isn't a viable reason for a hard dependency.

So, we can safely take option 5 out of the list of considerations. At this point, I'm leaning towards keeping the email notification stuff itself native to project_issue (since it's pretty specific). In terms of the tracker2 stuff, I'll let mirzu continue to investigate if we should do that via a very thin "tracker2" D7 port, or if we should just do what we need directly in project_issue using hooks. I don't think it's going to work to get flag-specific functionality committed to the core tracker, even in D8, much less D7. At best, we could get some new hooks invoked if we need them, but I really don't think we do -- we only care when a node is created, edited, or commented on, and there are already hooks for all of those events.

p.s. Since we're probably going to keep doing the email notifications ourselves, we might want to look at something like http://drupal.org/project/queue_mail (although sadly there are no official releases and no sign of a D7 port of that).

webchick’s picture

Awesome, thanks for researching that angle, anyway. It's good to be able to rule it out and have sound reasoning as to why.

The only thing I'd question is if those custom actions we'd have to write for Project Issue would be useful at all in other contexts; for example, in Views Bulk Operations for mass issue queue changing.

dww’s picture

Yeah, we even talked about VBO in our conversation. ;) #1093650: Provide VBO support for issue management is definitely still on my radar. If anything, the kind of stuff to support that would be coming from #1571400: Port auto-closing functionality to D7 not here. The main point is that we don't need all of rules to make that work. And if Rules isn't really the silver bullet I thought it might be, it's not worth the (3Mb uncompressed!) external dependency. If there were like 3 or 4 obvious win use cases, I'd be singing a very different tune. As it is, there's really only 1 case that's a reasonably good fit, and even that will require more work than I hoped...

mirzu’s picture

Sorry to be offline for a bit, one project ends another begins, and meetings meetings meetings. I'm in agreement with all the comments about rules, and email notifications. There isn't a good generic solution, so porting the old working stuff to d7 sounds like the most reasonable path.

For the follow functionality I'm thinking that a generic flag_tracker module is the way to go. Project issue can then use it, or we simply configure it to allow following of issues.

dww’s picture

I'm not entirely sure what "or we simply configure it to allow following of issues." means. Can you elaborate what you have in mind? Have you looked closely at how the following stuff works in project_issue already?

Thanks,
-Derek

dww’s picture

Note: just in terms of keeping patches/issues focused/smaller, *this* issue should be about the following itself (UI on issue nodes, tracker integration, etc) and then the email notification stuff itself should happen over at #1560012: Port per-user issue notification email functionality to D7...

senpai’s picture

Issue tags: +sprint 3

Tagging for Sprint 3.

mitchell’s picture

Rules Link should be a 6th option on the list. It meets the mentioned requirements of views integration, similar to vbo without bulk op, but is more lightweight than flag.

I originally advocated for flag, #34496-26: [meta] Add Flag module to allow users to subscribe/unsubscribe without posting a comment, well before the Rules Link module was developed, but it has since become a powerful alternative for all things flag can do minus the data storage.

The user subscription manifest would then need to be put in a manually created table because Rules Link does not provide a storage mechanism, ie user_followings=nids.

There are a few examples of it in Johnan's screencasts, http://dev.nodeone.se/node/1067 http://dev.nodeone.se/node/1068 and Rules Workflow project. Obviously, a subscription/following feature would be a little more impactful example...

dww’s picture

mitchell: Again, thanks for the input, but we already decided we can't add a dependency on Rules, therefore, rules_link is also off the table.

senpai’s picture

Issue tags: +sprint 4

Tagging for Sprint 4.

mirzu’s picture

Yay progress. http://drupal.org/sandbox/mirzu/1649546

This is the work in progress for moving the flag tracker code out of the issues and into it's own module. The meat of it works (it's a direct port of how it worked in 6). Today I hope to have it cleaned up and have added forms that allow users to select a flag per content type and globally. After that I'll create a patch that moves the code out of issues tracker that is made redundant.

mirzu’s picture

The Flag tracker module: http://drupal.org/sandbox/mirzu/1649546 is now ready for testing.

Try it out:

  1. download and enable the module (flag and tracker modules are required)
  2. Create a flag if you don't have one, insure that the flag is useable by the content type you want to enable tracking for.
  3. On any content type you should now have a new Flag Tracker vertical tab
  4. Select your flag for this content type.
  5. Create some content in that content type
  6. Log in as a different user and flag the content you created.
  7. view that user's tracker page (user//track)

Next is removing the bits of this that are duplicated in the project_issue module.

iamcarrico’s picture

Status: Active » Needs work

Few quick things:

1) Line 11 of the .module file, there is an extra indent.

2) I do not get the content to show up on user/{UID}/track.

3) On the flag that is pre-created you also have to choose to show it on the node and node teaser. Not sure if there is a way to fix that (or if we should).

#2 is the only one I am worried about, IRC mayhaps to chat about it?

iamcarrico’s picture

I just tested the most recent update, the new module code works great. Now just need the code to remove said functionality from the project_issue module.

mitchell’s picture

Since this issue and #1571400: Port auto-closing functionality to D7 are a bit commingled, I'm mentioning here that I added some info Re: 7 in the later parts of my comment in that issue. It's not at all meant to disrupt efforts on the existing porting. It's a parallel contribution, on my part, so that good options aren't forgone, especially from the above evaluation which needed some corrections.

mitchell’s picture

There's a base set of functionality for tracking available in Track N Notify. It's a proof of concept (in the sense that it uses features and a track node-type instead of an entity), however despite its incompleteness, it's functional and extensible.

Other elements like email queuing, a view for # of followers, and a view for whose subscribing will be simple enough additions. User digests and per-project subscription management are probably higher priority features, so that's what I'll focus on next. That's all for now.

mirzu’s picture

Attached is a patch that sets up project issue to use the flag_tracker module. There is likely some work still to be done, and I have a number of questions about a couple of things, but I figure it's better to post something at this point than to keep this under wraps.

Questions:
I'm not sure where this is called project_issue_flag_issue() greping for it only comes up with the one instance, so I'm not sure how to change it.
Where are the variables for the project-issue-summary.tpl.php generated? I couldn't find it.

mirzu’s picture

Talked about this in Project Project Scrum. I'm going to investigate how the project_issue_flag_issue() is used in the d6 version.

dww’s picture

I'm assuming the status here is still accurate and there's nothing for me to review at this time. Is that right? Please change this to "needs review" when that's appropriate. ;)

Thanks!
-Derek

mirzu’s picture

Status: Needs work » Needs review
StatusFileSize
new6.5 KB

I've updated the patch to use new settings included in the flag_tracker module. Should work correctly now and include the number of followers. Once the layout of a project issue page is finished should be an easy task to output the flag in the template. Shouldn't need to do anythine more than place the flag using the recomended method from the flag module. http://drupal.org/node/295383

<?php 
  $node = menu_get_object('node');
  print flag_create_link('project_issue_follow', $node->nid);
?>
mirzu’s picture

Fixed a couple of spelling errors found by Rob.

rgristroph’s picture

I read through the code for both this patch and the flag_tracker module that mirzu has in sandbox right now. We made a few small changes (typo type things). I tested on my own dev environment and we walked through setting it up, I followed and unfollowed an issue as admin and a test user, and checked the "Track" tab on the user account page. We fixed one error message that was popping up when you were the last person to unfollow something.

Also we ran a coder review.

This looks good to me !

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!! Marking rtbc :)

bdragon’s picture

Status: Reviewed & tested by the community » Fixed

Reviewed and committed, thanks. http://drupalcode.org/project/project_issue.git/commit/ace2c5e

I made a slight change in includes/notification.inc to avoid crashing in _project_issue_notification_levels on the user/%/project-issue form. (Note that this form does crash again later, but that's #1560012: Port per-user issue notification email functionality to D7's problem. ;)
http://drupalcode.org/project/project_issue.git/commit/746df4a

Mirzu, you're planning to promote your sandbox soon, right?

senpai’s picture

Issue tags: +sprint 5, +sprint 6

Tagging for Sprint 6.

mirzu’s picture

promoting tomorrow.

Status: Fixed » Closed (fixed)

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

dww’s picture

Assigned: mirzu » dww
Status: Closed (fixed) » Active

As per today's scrum call, I need to figure out what's actually happening with this code, make sure it's getting deployed/enabled/configured on the D7 staging site, make sure the follow button is actually showing up on issue nodes, etc, etc.

dww’s picture

Issue summary: View changes

updated summary to show remaining tasks for getting this stuff actually working again on the D7 site.

dww’s picture

Issue summary: View changes

added #1828652

dww’s picture

Issue summary: View changes

added #1828658

dww’s picture

Issue summary: View changes

added #1828756

dww’s picture

Title: Port issue following functionality to D7 » [META] Port issue following functionality to D7

There's a ton of progress in here, see the updated summary. Turning this into META.

dww’s picture

Assigned: dww » Unassigned
Status: Active » Postponed
drumm’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -project, -drupal.org D7, -sprint 1, -sprint 2, -sprint 3, -sprint 4, -sprint 5, -sprint 6

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

Anonymous’s picture

Issue summary: View changes

#1828560 is no longer relevant

klonos’s picture

Issue summary: View changes
Issue tags: +project, +drupal.org D7, +sprint 1, +sprint 2, +sprint 3, +sprint 4, +sprint 5, +sprint 6

...restoring tags eaten by the tag monster.