Problem/Motivation
Flag 8.x presently does not include Rules support as Rules 8.x was not yet mature enough to begin development. Flag and Rules can do beautiful things together, and is a must for a complete version of the module.
Proposed resolution
Implement Rules support for flagging events, as well as conditions and actions.
Events
#2540032: Port "Flag is flagged" Rules event to 8.x
#2540034: Port "Flag is unflagged" Rules event to 8.x
Conditions
#2540038: Port "Flag threshold" Rules condition to 8.x
#2540040: Port "Flag is flagged" Rules condition to 8.x
Actions
#2470647: Port "Fetch overall flag count" Rules action to 8.x
#2470653: Port "Fetch user flag count" Rules action to 8.x
#2470659: Port "Fetch [entity type] flagged by user" Rules action to 8.x
#2470661: Port "Flag a [entity type]" Rules action to 8.x
#2470665: Port "Unflag a [entity type]" Rules action to 8.x
#2470669: Port "Fetch users who have flagged a [entity type]" Rules action to 8.x
#2470651: Port "Fetch entity flag count" Rules action to 8.x
#2470645: Port "Trim flag" Rules action to 8.x
Remaining tasks
Code the plugins.
User interface changes
None.
API changes
None.
Comments
Comment #1
socketwench CreditAttribution: socketwench commentedThis issue is postponed until event support is added to Rules. See https://www.drupal.org/node/2145343
Comment #2
shabana.navas CreditAttribution: shabana.navas commentedAm looking to get on it once the above issue is cleared up in Rules.
Comment #3
dasjoWhile events aren't there yet, you can already implement actions & conditions for Rules. You can take a look at the core integrations that have been ported already:
https://github.com/fago/rules
#2269561: [META] Port all conditions to 8.x
#2269577: [META] Port all actions to 8.x
I think it would be great to create sub-tickets for creating some first action & condition integrations for the flag module to have a proof of concept for a first contrib module integrating with Rules 8.x :)
Comment #4
czigor CreditAttribution: czigor at Pronovix commentedComment #5
czigor CreditAttribution: czigor at Pronovix commentedComment #6
czigor CreditAttribution: czigor at Pronovix commentedComment #7
dasjoComment #8
dasjoSetting to active as some actions are already being ported. See their sub-tickets
Comment #9
martin107 CreditAttribution: martin107 commentedtriggering summary update
Comment #10
dasjonote that rules events are now ready for porting as well #2513476: [META] Port all events to 8.x
Comment #11
dasjoComment #12
socketwench CreditAttribution: socketwench as a volunteer commentedWe should start breaking down this meta into solvable issues now.
Comment #13
dasjoI have pushed a few fixes to my flag fork: for example the Action namespace has been renamed to RulesAction within rules:
https://github.com/dasjo/flag/commits/8.x-4.x-rules
Comment #14
dasjoComment #15
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedComment #16
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedComment #17
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedComment #18
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedComment #19
emclaughlin CreditAttribution: emclaughlin commentedQuestion: do all of the Action ones now depend on #2470661: Port "Flag a [entity type]" Rules action to 8.x being approved and merged? It creates a FlagActionBase class that I assume all of the actions would need to use. I'd really like to dive into this.
Comment #20
joachim CreditAttribution: joachim commentedThat sounds quite likely. The patch on that issue needs review from someone who's familiar with Rules.
Comment #21
dasjo#19 is correct, you would want to use the FlagActionBase from there
Comment #22
TR CreditAttribution: TR commentedPatch which implements "Flag is flagged" AND "Flag is unflagged" events, with tests, may be found in #2540032-21: Port "Flag is flagged" Rules event to 8.x
If you're interested in getting Rules functionality into Flag, please review that patch!
I will work on the Conditions after these two Events are committed.
Comment #23
TR CreditAttribution: TR commentedAs I stated 1.5 years ago, I am willing to do the work to port the Rules functionality for this module from D7 to D8. This is all predicated on getting the events ported first. Please review #2540032-21: Port "Flag is flagged" Rules event to 8.x if this is of interest to you.
Comment #24
CraigBertrand CreditAttribution: CraigBertrand as a volunteer commentedHey folks, what is the status on this? I have installed rules and flag and am having issues getting things to work.
I would be happy to test and perhaps do a how-to video from a user perspective as commits are made.
Comment #25
mobius_time CreditAttribution: mobius_time commentedHi all, what is the status of this? What does the road forward look like?
I am developing a site which I may have to do in D7 if Flags and Rules don't work nicely together.
I need to create a rule so that when particular flag is set on a comment or a node, I can then take action.
Thanks to the maintainers for all their hard work on this D8 port.