Add comment form to abuse report notes
What does this MR do and why?
- Resolves sub-task 4 of https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/issues/168 and follows-up from !134730 (merged)
- Adds a comment form to an abuse report, so admins can either add a new comment or reply to an existing one.
- Subscriptions, rich-text editing & quick-actions will be supported in a follow-up MR
Screenshots or screen recordings
Recording |
---|
comment-form |
How to set up and validate locally
- In the rails console, enable the feature flag
abuse_report_notes
> Feature.enable(:abuse_report_notes)
- Log-in as
root
and navigate to /admin/abuse_reports and click on any abuse report. If there aren't any abuse reports available, you can create one:
AbuseReport.create(user_id: User.last.id, reporter_id: User.first.id, message: "obvious spam")
- Try to add a new comment and then refresh the page.
- If you'd like to test replying to an existing comment, we'll need to create a thread first. For that, get the
discussion_id
of the last note you have created using:
AbuseReport.find(<ID>).notes.last.discussion_id
5. Then run the following GraphQL query by navigating to the http://127.0.0.1:3000/-/graphql-explorer page
fragment AbuseReportNote on Note {
id
body
bodyHtml
createdAt
lastEditedAt
url
resolved
discussion {
id
notes {
nodes {
id
}
}
}
}
mutation createAbuseReportNote($input: CreateNoteInput!) {
createNote(input: $input) {
note {
id
discussion {
id
notes {
nodes {
...AbuseReportNote
}
}
}
}
errors
}
}
# QUERY VARIABLES
{
"input": {
"noteableId": "gid://gitlab/AbuseReport/<ID>",
"body": "Reply comment",
"discussionId": "gid://gitlab/Discussion/<DISCUSSION_ID>"
}
}
- Lastly, navigate back to the abuse report where you'll see a comment thread and try adding another reply to that thread.
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