diff options
Diffstat (limited to 'app/services/merge_requests/bulk_remove_attention_requested_service.rb')
-rw-r--r-- | app/services/merge_requests/bulk_remove_attention_requested_service.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/services/merge_requests/bulk_remove_attention_requested_service.rb b/app/services/merge_requests/bulk_remove_attention_requested_service.rb index dd2ff741ba6..6573b623779 100644 --- a/app/services/merge_requests/bulk_remove_attention_requested_service.rb +++ b/app/services/merge_requests/bulk_remove_attention_requested_service.rb @@ -3,20 +3,24 @@ module MergeRequests class BulkRemoveAttentionRequestedService < MergeRequests::BaseService attr_accessor :merge_request + attr_accessor :users - def initialize(project:, current_user:, merge_request:) + def initialize(project:, current_user:, merge_request:, users:) super(project: project, current_user: current_user) @merge_request = merge_request + @users = users end + # rubocop: disable CodeReuse/ActiveRecord def execute return error("Invalid permissions") unless can?(current_user, :update_merge_request, merge_request) - merge_request.merge_request_assignees.update_all(state: :reviewed) - merge_request.merge_request_reviewers.update_all(state: :reviewed) + merge_request.merge_request_assignees.where(user_id: users).update_all(state: :reviewed) + merge_request.merge_request_reviewers.where(user_id: users).update_all(state: :reviewed) success end + # rubocop: enable CodeReuse/ActiveRecord end end |