Store abuse report labels separate from project/group labels
Context
This MR implements a part of https://gitlab.com/gitlab-org/gitlab/-/issues/430957+ and is MR no. 3 of 3:
- Move base label behavior to a concern
- Create AbuseReportLabelType GraphQL type
-
Store abuse report labels separate from project/group labels -
👈🏼 YOU ARE HERE
Gist of https://gitlab.com/gitlab-org/gitlab/-/issues/430957+
Abuse report labels are currently implemented as Label
s and stored in labels
DB table. Since these labels are for abuse reports they do not have a project_id
or a group_id
and should be under gitlab_main_clusterwide
schema (labels
is under gitlab_main_cell
).
The goal is to introduce a separate model and database table for abuse report labels so that both labels and abuse report labels features are compatible with Cells 1.0.
What does this MR do and why?
This MR introduces AntiAbuse::Reports::Label
and AntiAbuse::Reports::LabelLink
models backed by abuse_report_labels
and abuse_report_label_links
DB tables. It also updates the label_links
and labels
association of AbuseReport
to use these new models as follows:
Before
erDiagram
AbuseReport ||--o{ LabelLink : has_many
Label ||--o{ LabelLink : has_many
Label {
bigint group_id
bigint project_id
}
After
erDiagram
AbuseReport ||--o{ "AntiAbuse::Reports::LabelLink": has_many
"AntiAbuse::Reports::Label" ||--o{ "AntiAbuse::Reports::LabelLink" : has_many
Finally, Admin::AbuseReportLabel < Label
model is removed and all references to it are updated to use the new AntiAbuse::Reports::Label
model so abuse report labels records go to abuse_report_labels
table.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- In rails console, enable the feature flag
> Feature.enable(:abuse_report_labels)
- Login with an admin user (
root
) - Go to abuse reports page (http://localhost:3000/admin/abuse_reports) and click on any abuse report
- Validate that creating, searching, adding, and removing labels to the abuse report works