diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-11 15:10:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-11 15:10:20 +0000 |
commit | e3042fc5ced749e693ccef81b3f5838c55d5480c (patch) | |
tree | e004dca26da0ec413d5c9ebf174962a008fde0bb /app/controllers/groups/group_members_controller.rb | |
parent | c33a9adb709ffb40f816e66eb0c98cc750d6cd43 (diff) | |
download | gitlab-ce-e3042fc5ced749e693ccef81b3f5838c55d5480c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/groups/group_members_controller.rb')
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 64b7cbfacc3..43f1a1a847d 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -4,6 +4,7 @@ class Groups::GroupMembersController < Groups::ApplicationController include MembershipActions include MembersPresentation include SortingHelper + include Gitlab::Utils::StrongMemoize MEMBER_PER_PAGE_LIMIT = 50 @@ -21,6 +22,8 @@ class Groups::GroupMembersController < Groups::ApplicationController feature_category :authentication_and_authorization + helper_method :can_manage_members? + def index preload_max_access @sort = params[:sort].presence || sort_value_name @@ -29,7 +32,7 @@ class Groups::GroupMembersController < Groups::ApplicationController .new(@group, current_user, params: filter_params) .execute(include_relations: requested_relations) - if can_manage_members + if can_manage_members? @skip_groups = @group.related_group_ids @invited_members = @members.invite @@ -59,8 +62,10 @@ class Groups::GroupMembersController < Groups::ApplicationController current_user.max_access_for_group[@group.id] = @group.max_member_access(current_user) end - def can_manage_members - can?(current_user, :admin_group_member, @group) + def can_manage_members? + strong_memoize(:can_manage_members) do + can?(current_user, :admin_group_member, @group) + end end def present_invited_members(invited_members) |