Skip to content

Add comment form to abuse report notes

Hinam Mehra requested to merge anti-abuse/168-add-comment-form into master

What does this MR do and why?

Screenshots or screen recordings

Recording
comment-form

How to set up and validate locally

  1. In the rails console, enable the feature flag abuse_report_notes
> Feature.enable(:abuse_report_notes)
  1. 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")
  1. Try to add a new comment and then refresh the page.
  2. 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>"
    }
}
  1. 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.

Edited by Hinam Mehra

Merge request reports