Hi there ,
It would be useful a function or a button to remove the flags given to a user. It would be very useful also to the moderators.
I mean, when a user assigns a flag to another, this remains in the profile visible only to admin/mod. Exactly, it would be nice to delete these already assigned flags.
2 Likes
kelv
(Kelvin T)
June 5, 2023, 7:11am
2
I’ll be working on this feature and give updates along the way via the MR
3 Likes
kelv
(Kelvin T)
August 1, 2023, 8:44am
3
A fix that tackles this issue partially has been merged - we now only count posts with standard flags that were approved in the flag counters. This should reduce the noise in those counters.
discourse:main
← discourse:feat-only-count-approved-flags-for-counters
opened 09:20AM - 26 Jul 23 UTC
#### Context
Related topics:
1. Public Request: https://meta.discourse.org/t/… add-function-to-remove-flags-given-to-a-user/192750
This PR achieves the goal of reducing noise from flagged posts for admins/moderators by updating the counters in the user's profile page & admin view to only count posts with approved flags.
This more accurately reflects the signal from posts that were correctly flagged, and removes the noise from flags that were rejected, ignored or awaiting review.
#### Changes
* Modifying User#number_of_flagged_posts to only return the count of posts with approved flags, and associated model unit tests
* Updating the flagged post staff counter hyperlink to navigate to a filtered view of that user's approved flagged posts to maintain consistency with the counter
* Adding system tests for the profile page to cover the flagged posts staff counter
* Minor refactor of the user profile page object used for system testing
* Modifying User#flags_received_count to return posts with only approved standard flags
* Updating the `Show flags given` button in the user admin view to navigate to a filtered view of that user's approved flagged posts
#### Testing
How to test:
1. Populate a dev instance with topics & posts (with at least 5 from a specific user - this will be the flagged user)
4. All posts to be flagged should be from the same user.
5. Flag 3 posts with standard flags (i.e. `spam`, `inappropriate`, `off topic`).
6. As an admin/mod, review 2 of these posts with reject / ignore actions respectively, the last of these posts should be left as pending review.
7. Flag 1 post with a custom flag (i.e. `something else`)
8. Flag 1 post with 1 custom & 1 standard flag (you will need 2 different users here)
9. As an admin/mod, approve the flags from both posts above.
10. Navigate to the user's profile page and test for expected behaviour.
11. Navigate to the user's admin view via the Admin index of users search page and test for expected behaviour.
Testing Artifact:
https://github.com/discourse/discourse/assets/133760061/dd322974-285a-425f-8247-25a365f0c9e3
- 00:00 - 00:15 - Scrolling through 5 flagged posts, showing 1 pending, 1 rejected, 1 ignored and 2 approved (of which, one has all custom flags, and the other a mix of standard/custom flags)
- 00:15 - 00:25 - Click through to user profile page to show flagged posts counter, and click on that counter to view approved flagged posts for that user
- Expectation: Flagged Post counter should count all approved flagged posts
- 00:32 - 00:42 - View user page through admin users index, click through on Show Received Flags button to view approved flagged posts for that user
- Expectation: Received Flags counter should count all approved flagged posts with only standard flags
#### Considerations / Questions
1. `User#flags_received_count` and `User#number_of_flagged_posts` differ in **2 key aspects - the latter includes custom flags and includes flags from deleted posts**. It is possible that including custom flags in the count adds noise (the extent of which depends on the proportion of custom flags used for non-negative flagging, and also whether the counters should be interpreted as wholly negative signals in the first place). ~I don't have enough data to opine either way (other than [anecdata](https://meta.discourse.org/t/please-distinguish-flags-for-bad-things-from-organizational-and-please-help-flags/266073/2)) so would like some input on the approach here if we want to maintain consistency between the counters in the user's profile page & the user's admin view.~ **(UPDATE: we have decided to go forward with consistent behaviour for both methods which exclude custom flags and include flags of deleted posts)**
2. The other tricky part if we opt to exclude custom flags from the count is that the filtered view upon clicking on the `flagged-posts` counter / `Show Flags Received` button currently has no way to filter out posts with only custom flags (if we want to differentiate the 2, perhaps this could be the subject of a future PR).
---
_This PR was ported from a previous one (https://github.com/discourse/discourse/pull/22146), changes made in that earlier PR are captured in this first commit of this PR, and any updates from then are in subsequent commits. I'll squash everything prior to merge so we maintain a clean commit message._
5 Likes