Add system note when an issue is unlinked or linked to a violation

What does this MR do and why?

Add system note when an issue is unlinked or linked to a violation.

References

Closes #554254 (closed)

Screenshots or screen recordings

image

Before After

How to set up and validate locally

  1. Ensure you have ultimate license
  2. Enable feature flags compliance_violations_report and enable_project_compliance_violations.
  3. Visit the compliance violations dashboard. Eg: https://gdk.test:3000/flightjs/blank-project/-/security/compliance_dashboard/violations
  4. Open any violation and note its ID.
  5. Run the following mutations to link an issue to the above compliance violation
mutation linkViolationIssue {
  linkProjectComplianceViolationIssue(input: {
    violationId: "gid://gitlab/ComplianceManagement::Projects::ComplianceViolation/17",
    projectPath: "flightjs/blank-project",
    issueIid: "11"
  }
  ) {
    violation {
      id
      status
      issues {
        nodes {
          id
          title
        }
      }
    }
    errors
  }
}
  1. You can run the above with issues from different projects as well.
  2. Run the following mutation to unlink issues
mutation unlinkViolationIssue {
  unlinkProjectComplianceViolationIssue(input: {
    violationId: "gid://gitlab/ComplianceManagement::Projects::ComplianceViolation/17",
    projectPath: "flightjs/blank-project",
    issueIid: "1"
  }) {
    violation {
      id
      status
      issues {
        nodes {
          id
          title
        }
      }
    }
    errors
  }
}
  1. Visit the details page of the violation and you should see the linked and unlinked notes in the activity section similar to the screenshot above. Eg: https://gdk.test:3000/flightjs/blank-project/-/security/compliance_violations/17

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.

Edited by Huzaifa Iftikhar

Merge request reports

Loading