Skip to content

Add notes field to ComplianceViolationType

What does this MR do and why?

Enables notes and discussions on Project Compliance Violations by implementing the NoteableInterface for ComplianceViolationType. This allows users to add comments and collaborate on compliance violations through GraphQL API.

Closes #538810 (closed)

References

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Ensure you have ultimate license and you have few rows in ComplianceManagement::Projects::ComplianceViolation table. In case you don't then you can follow the instructions as per this MR to generate violations.
  2. Run the following GraphQL mutation to add comments to a project compliance violation
mutation {
  createNote(input: {
    body: "Test Note from GraphQL API with mentioning @root user",
    noteableId: "gid://gitlab/ComplianceManagement::Projects::ComplianceViolation/17"
  }) {
    note {
      id,
      discussion {
        id
      }
      body
    }
    errors
  }
}
  1. Run the following query to see the notes associated with a project compliance violation
query listProjectComplianceViolations {
  group(fullPath: "flightjs") {
    id,
    name,
    projectComplianceViolations {
      nodes {
        id,
        notes {
          nodes {
            body
          }
        }
        commenters {
          nodes {
            name
          }
        }
      }
    }
  }
}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Closes #538810 (closed)

Edited by Huzaifa Iftikhar

Merge request reports

Loading