diff options
author | Sean McGivern <sean@gitlab.com> | 2017-06-22 20:58:20 +0100 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-06-30 10:33:44 +0100 |
commit | 20bb678d91715817f3da04c7a1b73db84295accd (patch) | |
tree | 594cdb98e68ac0b60d901f499c2bc0466df54465 /app/finders | |
parent | 42ccb5981a8425216f9d69372754c52510f0cade (diff) | |
download | gitlab-ce-20bb678d91715817f3da04c7a1b73db84295accd.tar.gz |
Cache total issue / MR counts for project by user type
This runs a slightly slower query to get the issue and MR counts in the
navigation, but caches by user type (can see all / none confidential issues) for
two minutes.
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/issues_finder.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/app/finders/issues_finder.rb b/app/finders/issues_finder.rb index 3455a75b8bc..328198c026a 100644 --- a/app/finders/issues_finder.rb +++ b/app/finders/issues_finder.rb @@ -36,6 +36,19 @@ class IssuesFinder < IssuableFinder project_ids: current_user.authorized_projects(CONFIDENTIAL_ACCESS_LEVEL).select(:id)) end + def user_can_see_all_confidential_issues? + return false unless current_user + return true if current_user.full_private_access? + + project? && + project && + project.team.max_member_access(current_user.id) >= CONFIDENTIAL_ACCESS_LEVEL + end + + def user_cannot_see_confidential_issues? + current_user.blank? + end + private def init_collection @@ -57,17 +70,4 @@ class IssuesFinder < IssuableFinder def item_project_ids(items) items&.reorder(nil)&.select(:project_id) end - - def user_can_see_all_confidential_issues? - return false unless current_user - return true if current_user.full_private_access? - - project? && - project && - project.team.max_member_access(current_user.id) >= CONFIDENTIAL_ACCESS_LEVEL - end - - def user_cannot_see_confidential_issues? - current_user.blank? - end end |