Fix the compliance violations report not showing the merged by avatar
What does this MR do and why?
This MR resolves an issue where the compliance violations report wouldn't render the merge by user correctly to resolve #356691 (closed).
Note: This feature is deployed a default off feature flag.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
- You need a GitLab Ultimate license.
- Enable the feature flag in your terminal:
echo "Feature.enable(:compliance_violations_report);" | rails c
- View the compliance report and use the pagination feature:
[GDK_HOST]/groups/gitlab-org/-/security/compliance_dashboard
- Create several violations on the same MR by running this in
rails console
:
FactoryBot.definition_file_paths = [Rails.root.join('ee', 'spec', 'factories')]
FactoryBot.find_definitions
# Group 22 is gitlab-org by default
group = Group.find_by_id(22)
type = [:approved_by_insufficient_users, :approved_by_committer, :approved_by_merge_request_author]
project = group.projects.sample
merge_request = FactoryBot.create(:merge_request, source_project: project, target_project: project, state: :merged)
merge_request.metrics.update!(merged_at: 1.day.ago)
violations = 4.times.map {
FactoryBot.create(:compliance_violation, type.sample, severity_level: :high, merge_request: merge_request, violating_user: project.members.sample.user)
}
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.
Relates to #356691 (closed)
Edited by Jiaan Louw