diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-17 09:12:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-17 09:12:07 +0300 |
commit | 8624e54ae69729abf8664f1f1a57e90ee9ecab1a (patch) | |
tree | 5a582393864f83a1ae05b8c3cdcbc7e4de57f5b2 /lib/sidebars/groups/menus/invite_team_members_menu.rb | |
parent | f8edb3a740b9ba434489a50b69c2e765cecb24b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/sidebars/groups/menus/invite_team_members_menu.rb')
-rw-r--r-- | lib/sidebars/groups/menus/invite_team_members_menu.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/sidebars/groups/menus/invite_team_members_menu.rb b/lib/sidebars/groups/menus/invite_team_members_menu.rb new file mode 100644 index 00000000000..0779b696061 --- /dev/null +++ b/lib/sidebars/groups/menus/invite_team_members_menu.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module Sidebars + module Groups + module Menus + class InviteTeamMembersMenu < ::Sidebars::Menu + override :title + def title + s_('InviteMember|Invite members') + end + + override :render? + def render? + can?(context.current_user, :admin_group_member, context.group) && all_valid_members.size <= 1 + end + + override :menu_partial + def menu_partial + 'groups/invite_members_side_nav_link' + end + + override :menu_partial_options + def menu_partial_options + { + group: context.group, + title: title, + sidebar_menu: self + } + end + + override :extra_nav_link_html_options + def extra_nav_link_html_options + { + 'data-test-id': 'side-nav-invite-members' + } + end + + private + + def all_valid_members + GroupMembersFinder.new(context.group, context.current_user).execute + end + end + end + end +end |