diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /lib/api/entities/merge_request.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'lib/api/entities/merge_request.rb')
-rw-r--r-- | lib/api/entities/merge_request.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/api/entities/merge_request.rb b/lib/api/entities/merge_request.rb index 9ff8e20ced1..7fc76a4071e 100644 --- a/lib/api/entities/merge_request.rb +++ b/lib/api/entities/merge_request.rb @@ -39,6 +39,16 @@ module API expose :diverged_commits_count, as: :diverged_commits_count, if: -> (_, options) { options[:include_diverged_commits_count] } + # We put this into an option because list of TODOs API will attach their + # targets with Entities::MergeRequest instead of + # Entities::MergeRequestBasic, but this attribute cannot be eagerly + # loaded in batch for now. The list of merge requests API will + # use Entities::MergeRequestBasic which does not support this, and + # we always enable this for the single merge request API. This way + # we avoid N+1 queries in the TODOs API and can still enable it for + # the single merge request API. + expose :first_contribution?, as: :first_contribution, if: -> (_, options) { options[:include_first_contribution] } + def build_available?(options) options[:project]&.feature_available?(:builds, options[:current_user]) end |