Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 12:07:48 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 12:07:48 +0300
commit5bd24a54ef4ce3a38a860eb53b66d062c2382971 (patch)
tree5f5e65571dfcb2c62c27600ee7655dec4b44c923 /app/helpers/users_helper.rb
parent74673d04d25ffed35cbcf17cd42969bed0a4e705 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers/users_helper.rb')
-rw-r--r--app/helpers/users_helper.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 195e4154c67..e87bb27cf62 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -44,6 +44,14 @@ module UsersHelper
current_user_menu_items.include?(item)
end
+ # Used to preload when you are rendering many projects and checking access
+ #
+ # rubocop: disable CodeReuse/ActiveRecord: `projects` can be array which also responds to pluck
+ def load_max_project_member_accesses(projects)
+ current_user&.max_member_access_for_project_ids(projects.pluck(:id))
+ end
+ # rubocop: enable CodeReuse/ActiveRecord
+
def max_project_member_access(project)
current_user&.max_member_access_for_project(project.id) || Gitlab::Access::NO_ACCESS
end