Edit a violation comment

What does this MR do and why?

Add the ability to edit a violation comment.

The edit button is behind a feature flag (compliance_violation_comments_ui).

References

Related to #541095 (closed)

Screenshots or screen recordings

Before After Notes
Screenshot_2025-10-30_at_11.51.48_AM Screenshot_2025-10-30_at_11.51.11_AM Edit button, edited status
Screenshot_2025-10-30_at_11.54.53_AM Edit form displays upon clicking edit button
Screenshot_2025-10-30_at_11.53.05_AM Screenshot_2025-10-30_at_11.53.27_AM Also fixed this spacing error when there is no activity yet

How to set up and validate locally

  1. You need to have a group with Ultimate license.
  2. Required data, you need to have a project compliance violation to view:
    1. You need to have at least one project under the group, atleast one audit event related to the project.
    2. Also, have at least one compliance framework in the group, the framework should have atleast one compliance control.
    3. The framework should be applied to the project.
    4. Now create a compliance violation entry in the database by running following command in the rails console:
      ComplianceManagement::Projects::ComplianceViolation.create(project_id: <project_id>, namespace_id: <namespace_id>, audit_event_id: <audit_event_id>, compliance_requirements_control_id: <compliance_requirements_control_id>, status: 0, audit_event_table_name: 0)
  3. Navigate to the project that now has the violation, and go to path/to/project/-/security/compliance_violations/<violation-id>
  4. In rails console enable the feature flag
    Feature.enable(:compliance_violation_comments_ui)
  5. Verify that the form renders on the violation page
  6. Verify that comment preview works
  7. Submit a comment
  8. Verify that the note shows up on the violation details page, with an image if added

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 Scott Hampton

Merge request reports

Loading