diff options
author | Alexandru Croitor <acroitor@gitlab.com> | 2019-06-12 19:28:25 +0300 |
---|---|---|
committer | Alexandru Croitor <acroitor@gitlab.com> | 2019-06-18 12:46:46 +0300 |
commit | 09163e423ac50c8eda82f67e5419142893faf18a (patch) | |
tree | 91f687ddb99fd03db7894c238759eea086029d51 /lib/gitlab/issuable_metadata.rb | |
parent | e5ca7b8b0b5ba45f5847b6e545d17ca5af1cd929 (diff) | |
download | gitlab-ce-09163e423ac50c8eda82f67e5419142893faf18a.tar.gz |
Expose merge requests count based on user access
Count issues related merge requests based on user access level. And
issue can have related MRs from projects where user does not have
access so the number of related merge requests should be adjusted
based on user's ability to access the related MRs.
https://gitlab.com/gitlab-org/gitlab-ce/issues/59581
Diffstat (limited to 'lib/gitlab/issuable_metadata.rb')
-rw-r--r-- | lib/gitlab/issuable_metadata.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/issuable_metadata.rb b/lib/gitlab/issuable_metadata.rb index 351d15605e0..be73bcd5506 100644 --- a/lib/gitlab/issuable_metadata.rb +++ b/lib/gitlab/issuable_metadata.rb @@ -2,7 +2,7 @@ module Gitlab module IssuableMetadata - def issuable_meta_data(issuable_collection, collection_type) + def issuable_meta_data(issuable_collection, collection_type, user = nil) # ActiveRecord uses Object#extend for null relations. if !(issuable_collection.singleton_class < ActiveRecord::NullRelation) && issuable_collection.respond_to?(:limit_value) && @@ -23,7 +23,7 @@ module Gitlab issuable_votes_count = ::AwardEmoji.votes_for_collection(issuable_ids, collection_type) issuable_merge_requests_count = if collection_type == 'Issue' - ::MergeRequestsClosingIssues.count_for_collection(issuable_ids) + ::MergeRequestsClosingIssues.count_for_collection(issuable_ids, user) else [] end |