diff options
Diffstat (limited to 'app/controllers/projects/merge_requests/drafts_controller.rb')
-rw-r--r-- | app/controllers/projects/merge_requests/drafts_controller.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/controllers/projects/merge_requests/drafts_controller.rb b/app/controllers/projects/merge_requests/drafts_controller.rb index c75c3099051..74bb3ad1a63 100644 --- a/app/controllers/projects/merge_requests/drafts_controller.rb +++ b/app/controllers/projects/merge_requests/drafts_controller.rb @@ -57,10 +57,12 @@ class Projects::MergeRequests::DraftsController < Projects::MergeRequests::Appli end if Gitlab::Utils.to_boolean(approve_params[:approve]) - success = ::MergeRequests::ApprovalService.new(project: @project, current_user: current_user, params: approve_params).execute(merge_request) + unless merge_request.approved_by?(current_user) + success = ::MergeRequests::ApprovalService.new(project: @project, current_user: current_user, params: approve_params).execute(merge_request) - unless success - return render json: { message: _('An error occurred while approving, please try again.') }, status: :internal_server_error + unless success + return render json: { message: _('An error occurred while approving, please try again.') }, status: :internal_server_error + end end merge_request_activity_counter.track_submit_review_approve(user: current_user) |