The docs for this say:

> * Gets the count of the flaggings made by a user with a flag.

But if the flag is global, this needs clarification. With a global flag, all users count the same and an entity can only be flagged once. But at the same time, we do record the uid of the user who actually made the flagging.

So it's not clear whether with a global flag, this method will:

- throw an exception because the question doesn't make sense
- consider the uid on the flaggings
- ignore the uid on the flaggings, and therefore in this case work the same as getFlagEntityCount()

Comments

joachim created an issue.

c.nish2k3’s picture

The document here https://www.drupal.org/documentation/modules/flag says "Note that a global flag does not record the UID of the flagging user. If you need to know who flagged an item, do not set the flag to global."
So i believe, getUserFlagFlaggingCount() should return an exception for Global flag.

joachim’s picture

Good job on the research :) but those docs haven't been updated for the 8-4 branch at all, where we *do* record a uid on global flaggings.

Though I am leaning towards throwing an exception.

c.nish2k3’s picture

Thanks for pointing that out. So now the question is - how do we expect this function to behave on a global flag.

With Global flag, a user who flags it does it for all users. So if a global flag is set by a user, then is getUserFlagFlaggingCount() expected to return a valid count for any user?. Technically the flag is set for all users :).

If yes, then getUserFlagFlaggingCount() function does not work that way.
If not, then getUserFlagFlaggingCount() will work as expected. It will return the count of Global flags set by the user.