diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-13 21:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-13 21:09:34 +0300 |
commit | 53d77359a0e6bf78bfc8ef8c72995eebe1f9e63b (patch) | |
tree | 444eb2851a18271c20ea6fd23fab0b02b7e4d9b2 /lib/api/entities/merge_request_basic.rb | |
parent | dd7da8bd31926a1210011856f7d66ee43fa65156 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/entities/merge_request_basic.rb')
-rw-r--r-- | lib/api/entities/merge_request_basic.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/api/entities/merge_request_basic.rb b/lib/api/entities/merge_request_basic.rb index 16afc6c1f6a..f796aeba17f 100644 --- a/lib/api/entities/merge_request_basic.rb +++ b/lib/api/entities/merge_request_basic.rb @@ -55,7 +55,10 @@ module API # # For list endpoints, we skip the recheck by default, since it's expensive expose :merge_status do |merge_request, options| - merge_request.check_mergeability(async: true) unless options[:skip_merge_status_recheck] + if !options[:skip_merge_status_recheck] && can_check_mergeability?(merge_request.project) + merge_request.check_mergeability(async: true) + end + merge_request.public_merge_status end expose :detailed_merge_status @@ -101,6 +104,12 @@ module API def detailed_merge_status ::MergeRequests::Mergeability::DetailedMergeStatusService.new(merge_request: object).execute end + + def can_check_mergeability?(project) + return true if ::Feature.disabled?(:restrict_merge_status_recheck, project) + + Ability.allowed?(options[:current_user], :update_merge_request, project) + end end end end |