Aggregate multiple abuse reports by the user & category (detail view)
What does this MR do and why?
- Resolves 2nd sub-task of https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/180 (more information about the requirements in added in a comment)
- We have already aggregated open abuse reports by reported-user & category for the list view in !119282 (merged).
- In this MR, we will display the same aggregated reports in the detail view of an abuse report, so admins can see all the reported content in one place.
Query Plans
- Prepare the database by inserting abuse reports
/* 100 reports for user_id = 1 with status = open and category = spam */
exec INSERT INTO abuse_reports(user_id, reporter_id, status, category)
SELECT 1, generate_series(100, 200), 1, 1
/* 100 reports for user_id = 1 with status = closed and category = phishing */
exec INSERT INTO abuse_reports(user_id, reporter_id, status, category)
SELECT 1, generate_series(300, 400), 2, 2
Screenshots or screen recordings
Before | After |
---|---|
before | after |
How to set up and validate locally
- In rails console
> Feature.enable(:abuse_reports_list)
# Seed data
> AbuseReport.delete_all
# create 2 different reports for the same user & category with status = open
> User.limit(2).order_id_asc.pluck("id").each { |i| AbuseReport.create(reporter_id: i, user_id: User.last.id, status: "open", category: "spam", message: "test") }
# create another 2 for the same user but different category but status = closed
> User.limit(2).offset(2).order_id_asc.pluck("id").each { |i| AbuseReport.create(reporter_id: i, user_id: User.last.id, status: "closed", category: "spam", message: "test") }
- Log-in as
admin
and navigate to/admin/abuse_reports
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Hinam Mehra