diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-03 03:09:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-03 03:09:11 +0300 |
commit | a0754ad291e60e9411897ae4e05e01a600037ee9 (patch) | |
tree | d23b71bd0d4db9245aaa12d2fc81da20bcf0f105 /app/workers | |
parent | 90693cc231ba6e1645dc57f2a9111a7b5a5ceae0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 9 | ||||
-rw-r--r-- | app/workers/merge_requests/set_reviewer_reviewed_worker.rb | 30 |
2 files changed, 39 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 78ab6b5909b..77b6bf573df 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -2937,6 +2937,15 @@ :weight: 1 :idempotent: true :tags: [] +- :name: merge_requests_set_reviewer_reviewed + :worker_name: MergeRequests::SetReviewerReviewedWorker + :feature_category: :code_review_workflow + :has_external_dependencies: false + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: merge_requests_update_head_pipeline :worker_name: MergeRequests::UpdateHeadPipelineWorker :feature_category: :code_review_workflow diff --git a/app/workers/merge_requests/set_reviewer_reviewed_worker.rb b/app/workers/merge_requests/set_reviewer_reviewed_worker.rb new file mode 100644 index 00000000000..2f15bf3b879 --- /dev/null +++ b/app/workers/merge_requests/set_reviewer_reviewed_worker.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module MergeRequests + class SetReviewerReviewedWorker + include Gitlab::EventStore::Subscriber + + data_consistency :always + feature_category :code_review_workflow + urgency :low + idempotent! + + def handle_event(event) + current_user_id = event.data[:current_user_id] + merge_request_id = event.data[:merge_request_id] + current_user = User.find_by_id(current_user_id) + merge_request = MergeRequest.find_by_id(merge_request_id) + + if !current_user + logger.info(structured_payload(message: 'Current user not found.', current_user_id: current_user_id)) + elsif !merge_request + logger.info(structured_payload(message: 'Merge request not found.', merge_request_id: merge_request_id)) + else + project = merge_request.source_project + + ::MergeRequests::MarkReviewerReviewedService.new(project: project, current_user: current_user) + .execute(merge_request) + end + end + end +end |