Commit 9aaca694 authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch '262861-fix-compliance-dashboard-seed' into 'master'

Fix AccessDeniedError in Compliance Dashboard seed

See merge request gitlab-org/gitlab!44513
parents c984a22a 9cbcd585
...@@ -9,6 +9,10 @@ class Gitlab::Seeder::ComplianceDashboardMergeRequests ...@@ -9,6 +9,10 @@ class Gitlab::Seeder::ComplianceDashboardMergeRequests
@project = project @project = project
end end
def admin
@admin ||= create(:user, :admin)
end
def seed! def seed!
used_statuses = [] used_statuses = []
...@@ -54,10 +58,8 @@ class Gitlab::Seeder::ComplianceDashboardMergeRequests ...@@ -54,10 +58,8 @@ class Gitlab::Seeder::ComplianceDashboardMergeRequests
state: :opened state: :opened
} }
maintainer = @project.team.maintainers.sample || User.admins.first
Sidekiq::Worker.skipping_transaction_check do Sidekiq::Worker.skipping_transaction_check do
merge_request = MergeRequests::CreateService.new(@project, maintainer, opts).execute merge_request = MergeRequests::CreateService.new(@project, admin, opts).execute
merge_request.save! merge_request.save!
merge_request.approvals.create(approvals) merge_request.approvals.create(approvals)
merge_request.state = :merged merge_request.state = :merged
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment