Add more plugins

Created on 22 November 2022, about 2 years ago
Updated 30 January 2023, almost 2 years ago

Event

  1. A [Entity] has been Flagged under [Flagged name]
  2. A [Entity] has been Unflagged under [Flagged name]

Condition

  1. [Entity] has flagging count
    1. Field:
      1. Flag (to check for)
      2. Entity type (eg: node type to check for)
      3. Number (of flagging count)
      4. Comparison operation (greater than/greater than or equal to/equal to/less than or equal to/less than)
  2. [Entity] is flagged
    1. Field:
      1. Flag (to check for)
      2. [Entity] (Entity id)
      3. User on whose behalf to check (uid)

Action

  1. Flag a [Entity]
    1. Field:
      1. Flag (to check for)
      2. [Entity] (Entity id)
      3. User on whose behalf to flag (For non-global flags, this is the user on whose behalf to flag the object. In addition, if checked below, the access permissions to the flag are checked against this user.)
      4. skip permission check (true/false)
  2. Unflag a [Entity]
    1. Field is the same as flag a [entity]
  3. Trim a Flag
    1. Field:
      1. Flag (to check for)
      2. User whose flag to trim (For non-global flags, this is the user whose flag to trim. (For global flags, this argument is ignored.))
      3. Flag queue size (The maximum number of objects to keep in the queue. Newly flagged objects will be kept; older ones will be removed. Tip: by typing "1" here you implement a singleton.)
      4. Trim newest flags (True/False)
      5. Skip permission check (True/False)
  4. Fetch users who has flagged a [Entity]
    1. Field:
      1. Flag (to check for)
      2. Entity id
      3. provided variables (Users who flagged to be used for another action)
        1. variable label
        2. variable name
  5. Fetch [Entity} flagged by user
    1. Field:
      1. Flag (to check for)
      2. User who flagged the [entity] (For non-global flags, this is the user who flagged the [Entity]. (For global flags, this argument is ignored.))
      3. provided variables (Content flagged by user to be used for another action)
        1. variable label
        2. variable name
  6. Fetch entity flag by count
    1. Field:
      1. Flag (to check for)
      2. Entity type
      3. provided variables (Content flagged by user to be used for another action)
        1. variable label
        2. variable name
  7. Fetch overall flag by count
    1. Field:
      1. Flag (to check for)
      2. provided variables (overall flag count to be used for another action)
        1. variable label
        2. variable name
  8. Fetch user flag by count
    1. Field:
      1. Flag (to check for)
      2. User (uid)
      3. provided variables (user flag count to be used for another action)
        1. variable label
        2. variable name

Original Post:
or maybe this module is not ready for any flagging yet?

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇲🇾Malaysia rodmarasi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Should I just get started on the suggested solution in #9 or is there any feedback that would tell otherwise?

  • 🇲🇾Malaysia muaz91 MY

    sorry for the late reply @jurgenhaas

    Events

    Is there a use case where those 2 events would be used without providing a flag name? In other words, the same event, but more generic?

    I think not, the event needs to be trigger with a flag name, specifically flag_id

    There is potential confusion because there are already other events, that would provide the same functinality: when a flag entity gets created (a.k.a. an entity got flagged) or deleted (a.k.a. an entity got unflagged). So, instead of creating new events, we could use those that are already there and provide access to the respective flagged or undflagged entity by adding that to the token stack in addition to the flag entity. Also, the flag name could be asserted in a condition.

    For me personally, I know that the event insert an entity and delete an entity is the same as flagged and unflagged. However, for the perspective of the maybe some user whom use the flag, they might confuse with the term. Maybe atleast need to describe it at the front page of the eca_flags? or in the eca documentation, so at least others know about it? also need to remove the flag/unflag event in the eca_flag module to avoid more confusion.

    Conditions

    [Entity] has flagging count: this makes sense, but I don't think we need the second field "Entity type" because we're checking an explicit entity which has its type and bundle. Right?
    [Entity] is flagged: same as above, makes sense but we don't need a field for the entity ID because we are checking for a given entity. OK?

    for the conditions, I have use the [entity] is flagged, the exact example is "node is flagged", the use case for me is when a person A is flagging a specific node with node type = article, entity_id is nid = 3, user whom behalf to check is uid = 1, then an action will trigger. Maybe the entity type is not that required after all, but the entity_id is important as it can specify what is the specific entity that we will check.

    In addition to achieve what I proposed for the events above, we should add a condition to check the flag name for the flag entity that got created or deleted by the preceeding event.

    agreed

    Actions

    The first 2 actions are not required, as they already exist in the Flag module, don't they?

    I Think so, I saw it in the actions, but not test it out yet

    Trim a Flag: what's that? I'm not sure what's meant by trimming a flag.

    Sorry, I too does not know about it. Maybe for limiting the number of flags? this is just a speculation based on this issue que https://www.drupal.org/project/flag/issues/1094048

    Fetch users who have flagged [Entity]: couldn't that be done with views?
    Fetch entities flagged by user: same as above, I would have thought that views should be able to do that, no?
    Fetch entity flag by count: what does that do?
    Fetch overall flag by count: same question, I'm not sure what this is doing?
    Fetch user flag by count: and also here, please clarify the purpose of this.

    This too, I also does not know as I am not use the actions..

    Apologize, this is very much info that I can give and help out.. Thank you very much for your work @jurgenhaas

  • Assigned to jurgenhaas
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks a lot @muaz91 for your extra feedback, this is great help for me and there's no reason to apologize. You're doing so much above and beyond the "normal user", it's really much appreciated.

    I think, I'm able to get this implemented with your comments from above and once we'll have that available to play with, it may become easier for us and hopefully other, to identify further gaps. Those can then be filled in subsequent steps.

    And you're absolutely right, we need to write documentation so that people understand how to use all this. Ideally, a nice overview on the project page, with all the details in the ECA Guide then.

    • jurgenhaas committed bd24f424 on 1.0.x
      Issue #3323026 by rodmarasi, jurgenhaas, muaz91: Add more plugins
      
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Although the flag module is not ready yet - as stated on its project page - I guess we have a pretty good integration by now in our dev release of eca_flag.

    Foremost, you need to apply the patch from https://www.drupal.org/project/flag/issues/2500091#comment-14848519 🐛 Re-implement hook_tokens() Needs work on the flag module because otherwise you won't have any tokens, but they are essential for the functionality.

    Then, here is how it works:

    • Events
      • I kept both approaches in. You can either react on Insert flagging entity or Flag events. Both will operate similarly. The same for either Delete flagging entity or Unflag events.
      • If either of those events gets triggered, ECA puts several things onto the token stack:
        • flag the flag entity
        • flagging the flagging entity
        • entity the flagged or unflagged entity

        Note: if a flagging gets added or if the unflagging happens on exactly on entity, then you get those items on the token stack. However, unflagging can be triggered for many entities at once, then you get a list on the token system under the name flaggings where each item in the list contains the tokens listed above

    • Conditions
      • There is 1 new condition from eca_flag which asserts if a given entity is flagged or not
      • All other conditions can be achieved with the Compare two scalar values condition by using tokens from the flag entities
    • Actions
      • There is one new action to get one or many flagging entities for a given entity and stored as an entity or a list of entities onto the token stack

    I've played around with this and it looks as if everything described above can be achieved with these building blocks.

    Please review if you can and then we could publish a first beta release. Adding more plugins later is still possible, but for now, it feels as if this is now done.

  • Status changed to RTBC almost 2 years ago
  • 🇲🇾Malaysia muaz91 MY

    Test out the patch. I mark this as RTBC.. Thank you @jurgenhaas

  • Status changed to Fixed almost 2 years ago
  • 🇩🇪Germany jurgenhaas Gottmadingen

    Thanks a lot @muaz91 for reviewing this and all your input to the effort. We can now publish a first beta release, which is great news.

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

Production build 0.71.5 2024