Commit f953bfff authored by Doug Stull's avatar Doug Stull Committed by Kushal Pandya

Remove the invite members modal feature flag

- remove feature flag
- remove create action on rails member controllers

Changelog: other
EE: true
parent 58ee20a1
......@@ -28,7 +28,12 @@ export default {
</script>
<template>
<gl-button :class="classes" data-qa-selector="invite_a_group_button" @click="openModal">
<gl-button
:class="classes"
data-qa-selector="invite_a_group_button"
data-test-id="invite-group-button"
@click="openModal"
>
{{ displayText }}
</gl-button>
</template>
import { disableButtonIfEmptyField } from '~/lib/utils/common_utils';
// This is only used when `invite_members_group_modal` feature flag is disabled.
// This file can be removed when `invite_members_group_modal` feature flag is removed
export default () => {
disableButtonIfEmptyField('#user_ids', 'input[name=commit]', 'change');
};
......@@ -2,7 +2,6 @@ import { groupMemberRequestFormatter } from '~/groups/members/utils';
import groupsSelect from '~/groups_select';
import initInviteGroupTrigger from '~/invite_members/init_invite_group_trigger';
import initInviteGroupsModal from '~/invite_members/init_invite_groups_modal';
import initInviteMembersForm from '~/invite_members/init_invite_members_form';
import initInviteMembersModal from '~/invite_members/init_invite_members_modal';
import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger';
import { s__ } from '~/locale';
......@@ -61,8 +60,4 @@ initInviteGroupsModal();
initInviteMembersTrigger();
initInviteGroupTrigger();
// This is only used when `invite_members_group_modal` feature flag is disabled.
// This can be removed when `invite_members_group_modal` feature flag is removed.
initInviteMembersForm();
new UsersSelect(); // eslint-disable-line no-new
import groupsSelect from '~/groups_select';
import initImportAProjectModal from '~/invite_members/init_import_a_project_modal';
import initInviteGroupTrigger from '~/invite_members/init_invite_group_trigger';
import initInviteMembersForm from '~/invite_members/init_invite_members_form';
import initInviteMembersModal from '~/invite_members/init_invite_members_modal';
import initInviteGroupsModal from '~/invite_members/init_invite_groups_modal';
import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger';
......@@ -22,10 +21,6 @@ initInviteGroupsModal();
initInviteMembersTrigger();
initInviteGroupTrigger();
// This is only used when `invite_members_group_modal` feature flag is disabled.
// This can be removed when `invite_members_group_modal` feature flag is removed.
initInviteMembersForm();
new UsersSelect(); // eslint-disable-line no-new
const SHARED_FIELDS = ['account', 'maxRole', 'expiration', 'actions'];
......
......@@ -26,8 +26,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
@sort = params[:sort].presence || sort_value_name
if can?(current_user, :admin_group_member, @group)
@skip_groups = @group.related_group_ids
@invited_members = invited_members
@invited_members = @invited_members.search_invite_email(params[:search_invited]) if params[:search_invited].present?
@invited_members = present_invited_members(@invited_members)
......@@ -38,8 +36,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
@requesters = present_members(
AccessRequestsFinder.new(@group).execute(current_user)
)
@group_member = @group.group_members.new
end
# MembershipActions concern
......
......@@ -13,8 +13,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def index
@sort = params[:sort].presence || sort_value_name
@skip_groups = @project.related_group_ids
@group_links = @project.project_group_links
@group_links = @group_links.search(params[:search_groups]) if params[:search_groups].present?
......@@ -24,8 +22,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController
end
@project_members = present_members(non_invited_members.page(params[:page]))
@project_member = @project.project_members.new
end
def import
......
......@@ -9,10 +9,6 @@ module Groups::GroupMembersHelper
{ multiple: true, class: 'input-clamp qa-member-select-field ', scope: :all, email_user: true }
end
def render_invite_member_for_group(group, default_access_level)
render 'shared/members/invite_member', submit_url: group_group_members_path(group), access_levels: group.access_level_roles, default_access_level: default_access_level
end
def group_members_app_data(group, members:, invited:, access_requests:)
{
user: group_members_list_data(group, members, { param_name: :page, params: { invited_members_page: nil, search_invited: nil } }),
......
......@@ -6,7 +6,7 @@ module InviteMembersHelper
def can_invite_members_for_project?(project)
# do not use the can_admin_project_member? helper here due to structure of the view and how membership_locked?
# is leveraged for inviting groups
Feature.enabled?(:invite_members_group_modal, project.group, default_enabled: :yaml) && can?(current_user, :admin_project_member, project)
can?(current_user, :admin_project_member, project)
end
def invite_accepted_notice(member)
......
- add_page_specific_style 'page_bundles/members'
- page_title _('Group members')
- groups_select_tag_data = group_select_data(@group).merge({ skip_groups: @skip_groups })
.row.gl-mt-3
.col-lg-12
......@@ -11,28 +10,15 @@
= _('Group members')
%p
= html_escape(_('You can invite a new member to %{strong_start}%{group_name}%{strong_end}.')) % { group_name: @group.name, strong_start: '<strong>'.html_safe, strong_end: '</strong>'.html_safe }
- if Feature.enabled?(:invite_members_group_modal, @group, default_enabled: :yaml)
.gl-w-half.gl-xs-w-full
.gl-display-flex.gl-flex-wrap.gl-justify-content-end.gl-mb-3
.js-invite-group-trigger{ data: { classes: 'gl-mt-3 gl-sm-w-auto gl-w-full', display_text: _('Invite a group') } }
.js-invite-members-trigger{ data: { variant: 'confirm',
classes: 'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3',
trigger_source: 'group-members-page',
display_text: _('Invite members') } }
= render 'groups/invite_groups_modal', group: @group
= render 'groups/invite_members_modal', group: @group
- if can_admin_group_member?(@group) && Feature.disabled?(:invite_members_group_modal, @group, default_enabled: :yaml)
%hr.gl-mt-4
%ul.nav-links.nav.nav-tabs.gitlab-tabs{ role: 'tablist' }
%li.nav-tab{ role: 'presentation' }
%a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _('Invite member')
%li.nav-tab{ role: 'presentation' }
%a.nav-link{ href: '#invite-group-pane', id: 'invite-group-tab', data: { toggle: 'tab', qa_selector: 'invite_group_tab' }, role: 'tab' }= _('Invite group')
.tab-content.gitlab-tab-content
.tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' }
= render_invite_member_for_group(@group, @group_member.access_level)
.tab-pane{ id: 'invite-group-pane', role: 'tabpanel' }
= render 'shared/members/invite_group', submit_url: group_group_links_path(@group), access_levels: GroupMember.access_level_roles, default_access_level: @group_member.access_level, group_link_field: 'shared_with_group_id', group_access_field: 'shared_group_access', groups_select_tag_data: groups_select_tag_data
.gl-w-half.gl-xs-w-full
.gl-display-flex.gl-flex-wrap.gl-justify-content-end.gl-mb-3
.js-invite-group-trigger{ data: { classes: 'gl-mt-3 gl-sm-w-auto gl-w-full', display_text: _('Invite a group') } }
.js-invite-members-trigger{ data: { variant: 'confirm',
classes: 'gl-mt-3 gl-sm-w-auto gl-w-full gl-sm-ml-3',
trigger_source: 'group-members-page',
display_text: _('Invite members') } }
= render 'groups/invite_groups_modal', group: @group
= render 'groups/invite_members_modal', group: @group
= render_if_exists 'groups/group_members/ldap_sync'
......
......@@ -39,47 +39,6 @@
%p
= html_escape(_("Members can be added by project %{i_open}Maintainers%{i_close} or %{i_open}Owners%{i_close}")) % { i_open: '<i>'.html_safe, i_close: '</i>'.html_safe }
- if Feature.disabled?(:invite_members_group_modal, @project.group, default_enabled: :yaml) && can?(current_user, :admin_project_member, @project) && project_can_be_shared?
- if !membership_locked? && @project.allowed_to_share_with_group?
%ul.nav-links.nav.nav-tabs.gitlab-tabs{ role: 'tablist' }
%li.nav-tab{ role: 'presentation' }
%a.nav-link.active{ href: '#invite-member-pane', id: 'invite-member-tab', data: { toggle: 'tab' }, role: 'tab' }= _("Invite member")
%li.nav-tab{ role: 'presentation', class: ('active' if membership_locked?) }
%a.nav-link{ href: '#invite-group-pane', id: 'invite-group-tab', data: { toggle: 'tab', qa_selector: 'invite_group_tab' }, role: 'tab' }= _("Invite group")
.tab-content.gitlab-tab-content
.tab-pane.active{ id: 'invite-member-pane', role: 'tabpanel' }
= render 'shared/members/invite_member',
submit_url: project_project_members_path(@project),
access_levels: ProjectMember.access_level_roles,
default_access_level: @project_member.access_level,
can_import_members?: can_admin_project_member?(@project),
import_path: import_project_project_members_path(@project)
.tab-pane{ id: 'invite-group-pane', role: 'tabpanel', class: ('active' if membership_locked?) }
= render 'shared/members/invite_group',
submit_url: project_group_links_path(@project),
access_levels: ProjectGroupLink.access_options,
default_access_level: ProjectGroupLink.default_access,
group_link_field: 'link_group_id',
group_access_field: 'link_group_access',
groups_select_tag_data: { min_access_level: Gitlab::Access::GUEST, skip_groups: @skip_groups }
- elsif !membership_locked?
.invite-member
= render 'shared/members/invite_member',
submit_url: project_project_members_path(@project),
access_levels: ProjectMember.access_level_roles,
default_access_level: @project_member.access_level,
can_import_members?: can_admin_project_member?(@project),
import_path: import_project_project_members_path(@project)
- elsif @project.allowed_to_share_with_group?
.invite-group
= render 'shared/members/invite_group',
access_levels: ProjectGroupLink.access_options,
default_access_level: ProjectGroupLink.default_access,
submit_url: project_group_links_path(@project),
group_link_field: 'link_group_id',
group_access_field: 'link_group_access',
groups_select_tag_data: { min_access_level: Gitlab::Access::GUEST, skip_groups: @skip_groups }
.js-project-members-list-app{ data: { members_data: project_members_app_data_json(@project,
members: @project_members,
group_links: @group_links,
......
- access_levels = local_assigns[:access_levels]
- default_access_level = local_assigns[:default_access_level]
- submit_url = local_assigns[:submit_url]
- group_link_field = local_assigns[:group_link_field]
- group_access_field = local_assigns[:group_access_field]
- groups_select_tag_data = local_assigns[:groups_select_tag_data]
.row
.col-sm-12
= form_tag submit_url, class: 'invite-group-form js-requires-input', method: :post do
.form-group
= label_tag group_link_field, _("Select a group to invite"), class: "label-bold"
= groups_select_tag(group_link_field, data: groups_select_tag_data, class: 'input-clamp qa-group-select-field', required: true)
.form-text.text-muted.gl-mb-3
= _('Group sharing provides access to all group members (including members who inherited group membership from a parent group).')
.form-group
= label_tag group_access_field, _("Max role"), class: "label-bold"
.select-wrapper
= select_tag group_access_field, options_for_select(access_levels, default_access_level), data: { qa_selector: 'group_access_field' }, class: "form-control select-control"
= sprite_icon('chevron-down', css_class: "gl-icon gl-absolute gl-top-3 gl-right-3 gl-text-gray-200")
.form-text.text-muted.gl-mb-3
- permissions_docs_path = help_page_path('user/permissions')
- link_start = %q{<a href="%{url}">}.html_safe % { url: permissions_docs_path }
= _("%{link_start}Learn more%{link_end} about roles.").html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
.form-group
= label_tag :expires_at, _('Access expiration date'), class: 'label-bold'
.clearable-input
= text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date-groups', placeholder: _('Expiration date'), id: 'expires_at_groups'
= sprite_icon('close', size: 16, css_class: 'clear-icon js-clear-input gl-text-gray-200')
= submit_tag _("Invite"), class: "gl-button btn btn-confirm gl-mr-3", data: { qa_selector: 'invite_group_button' }
- access_levels = local_assigns[:access_levels]
- default_access_level = local_assigns[:default_access_level]
- submit_url = local_assigns[:submit_url]
- can_import_members = local_assigns[:can_import_members?]
- import_path = local_assigns[:import_path]
.row
.col-sm-12
= form_tag submit_url, class: 'invite-users-form', data: { testid: 'invite-users-form' }, method: :post do
.form-group
= label_tag :user_ids, _("GitLab member or Email address"), class: "label-bold"
= users_select_tag(:user_ids, multiple: true, class: 'input-clamp qa-member-select-field', scope: :all, email_user: true, placeholder: 'Search for members to update or invite')
.form-group
= label_tag :access_level, _("Select a role"), class: "label-bold"
.select-wrapper
= select_tag :access_level, options_for_select(access_levels, default_access_level), class: "form-control project-access-select select-control"
= sprite_icon('chevron-down', css_class: "gl-icon gl-absolute gl-top-3 gl-right-3 gl-text-gray-200")
.form-text.text-muted.gl-mb-3
- permissions_docs_path = help_page_path('user/permissions')
- link_start = %q{<a href="%{url}">}.html_safe % { url: permissions_docs_path }
= _("%{link_start}Learn more%{link_end} about roles.").html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
.form-group
= label_tag :expires_at, _('Access expiration date'), class: 'label-bold'
.clearable-input
= text_field_tag :expires_at, nil, class: 'form-control js-access-expiration-date', placeholder: 'Expiration date'
= sprite_icon('close', size: 16, css_class: 'clear-icon js-clear-input gl-text-gray-200')
= submit_tag _("Invite"), class: "gl-button btn btn-confirm gl-mr-2", data: { qa_selector: 'invite_member_button' }
- if can_import_members
= link_to _("Import"), import_path, class: "gl-button btn btn-default", title: _("Import members from another project")
---
name: invite_members_group_modal
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37906
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/247208
milestone: '13.5'
type: development
group: group::expansion
default_enabled: true
......@@ -84,6 +84,7 @@ You can give a user access to all projects in a group.
1. On the top bar, select **Menu > Groups** and find your group.
1. On the left sidebar, select **Group information > Members**.
1. Select **Invite members**.
1. Fill in the fields.
- The role applies to all projects in the group. [Learn more about permissions](../permissions.md).
- On the **Access expiration date**, the user can no longer access projects in the group.
......@@ -280,12 +281,8 @@ To view the activity feed in Atom format, select the
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18328) in GitLab 12.7.
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 13.11 from a form to a modal window [with a flag](../feature_flags.md). Disabled by default.
> - Modal window [enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 14.8.
FLAG:
On self-managed GitLab, by default the modal window feature is available.
To hide the feature, ask an administrator to [disable the feature flag](../../administration/feature_flags.md)
named `invite_members_group_modal`.
On GitLab.com, this feature is available.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) in GitLab 14.9.
[Feature flag `invite_members_group_modal`](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) removed.
Similar to how you [share a project with a group](../project/members/share_project_with_groups.md),
you can share a group with another group. Members get direct access
......
......@@ -45,12 +45,8 @@ flowchart RL
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 13.11 from a form to a modal window [with a flag](../../feature_flags.md). Disabled by default.
> - Modal window [enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 14.8.
FLAG:
On self-managed GitLab, by default the modal window feature is available.
To hide the feature, ask an administrator to [disable the feature flag](../../../administration/feature_flags.md)
named `invite_members_group_modal`.
On GitLab.com, this feature is available.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) in GitLab 14.9.
[Feature flag `invite_members_group_modal`](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) removed.
Add users to a project so they become members and have permission
to perform actions.
......@@ -83,12 +79,8 @@ using the email address the invitation was sent to.
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 13.11 from a form to a modal window [with a flag](../../feature_flags.md). Disabled by default.
> - Modal window [enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 14.8.
FLAG:
On self-managed GitLab, by default the modal window feature is available.
To hide the feature, ask an administrator to [disable the feature flag](../../../administration/feature_flags.md)
named `invite_members_group_modal`.
On GitLab.com, this feature is available.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) in GitLab 14.9.
[Feature flag `invite_members_group_modal`](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) removed.
When you add a group to a project, each user in the group gets access to the project.
Each user's access is based on:
......
......@@ -17,8 +17,12 @@ members.
## Share a project with a group of users
NOTE:
In GitLab 13.11, you can [replace this form with a modal window](#share-a-project-modal-window).
> - [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 13.11 from a form to a modal
window [with a flag](../../feature_flags.md). Disabled by default.
> - Modal window [enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/issues/247208)
in GitLab 14.8.
> - [Generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) in GitLab 14.9.
[Feature flag `invite_members_group_modal`](https://gitlab.com/gitlab-org/gitlab/-/issues/352526) removed.
The primary mechanism to give a group of users, say 'Engineering', access to a project,
say 'Project Acme', in GitLab is to make the 'Engineering' group the owner of 'Project
......@@ -28,9 +32,9 @@ This is where the group sharing feature can be of use.
To share 'Project Acme' with the 'Engineering' group:
1. For 'Project Acme' use the left navigation menu to go to **Project information > Members**.
1. Select the **Invite group** tab.
1. Select **Invite a group**.
1. Add the 'Engineering' group with the maximum access level of your choice.
1. Optional. Select an expiration date.
1. Optional. Select an **Access expiration date**.
1. Select **Invite**.
After sharing 'Project Acme' with 'Engineering':
......@@ -45,46 +49,6 @@ You can share a project only with:
Administrators can share projects with any group in the system.
### Share a project modal window
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/247208) in GitLab 13.11.
> - [Deployed behind a feature flag](../../feature_flags.md), disabled by default.
> - Enabled on GitLab.com.
> - Recommended for production use.
> - Replaces the existing form with buttons to open a modal window.
> - To use in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-modal-window).
WARNING:
This feature might not be available to you. Check the **version history** note above for details.
In GitLab 13.11, you can optionally replace the sharing form with a modal window.
To share a project after enabling this feature:
1. Go to your project's page.
1. On the left sidebar, go to **Project information > Members**, and then select **Invite a group**.
1. Select a group, and select a **Max role**.
1. Optional. Select an **Access expiration date**.
1. Select **Invite**.
### Enable or disable modal window **(FREE SELF)**
The modal window for sharing a project is under development and is ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/feature_flags.md)
can enable it.
To enable it:
```ruby
Feature.enable(:invite_members_group_modal)
```
To disable it:
```ruby
Feature.disable(:invite_members_group_modal)
```
## Maximum access level
In the example above, the maximum access level of 'Developer' for members from 'Engineering' means that users with higher access levels in 'Engineering' ('Maintainer' or 'Owner') only have 'Developer' access to 'Project Acme'.
......
......@@ -79,24 +79,5 @@ RSpec.describe 'Groups > Members > List members' do
expect(page).not_to have_content(user4.name)
end
end
context 'when the :invite_members_group_modal feature flag is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'returns only users with SAML in autocomplete', :js do
visit group_group_members_path(group)
wait_for_requests
find('.select2-container').click
expect(page).to have_content(user1.name)
expect(page).to have_content(user2.name)
expect(page).not_to have_content(user3.name)
expect(page).not_to have_content(user4.name)
end
end
end
end
......@@ -9,30 +9,17 @@ RSpec.describe 'Project > Members > Invite group and members' do
let(:maintainer) { create(:user) }
using RSpec::Parameterized::TableSyntax
it 'displays the invite modal button triggers' do
project = create(:project, namespace: create(:group))
where(:invite_members_group_modal_enabled, :expected_invite_member_selector, :expected_invite_group_selector, :expected_import_button_selector) do
true | '.js-invite-members-trigger' | '.js-invite-group-trigger' | '.js-import-a-project-modal'
false | '#invite-member-tab' | '#invite-group-tab' | '.invite-users-form .btn-default'
end
with_them do
before do
stub_feature_flags(invite_members_group_modal: invite_members_group_modal_enabled)
end
project.add_maintainer(maintainer)
sign_in(maintainer)
it 'displays either the invite modal button triggers or the form with tabs based on the feature flag' do
project = create(:project, namespace: create(:group))
visit project_project_members_path(project)
project.add_maintainer(maintainer)
sign_in(maintainer)
visit project_project_members_path(project)
expect(page).to have_selector(expected_invite_member_selector)
expect(page).to have_selector(expected_invite_group_selector)
expect(page).to have_selector(expected_import_button_selector)
end
expect(page).to have_selector('.js-invite-members-trigger')
expect(page).to have_selector('.js-invite-group-trigger')
expect(page).to have_selector('.js-import-a-project-modal')
end
describe 'Share group lock' do
......
......@@ -36,7 +36,6 @@ RSpec.describe "User manages members" do
context "as project maintainer" do
before do
stub_feature_flags(invite_members_group_modal: true)
project.add_maintainer(user)
end
......@@ -46,55 +45,10 @@ RSpec.describe "User manages members" do
context "as group owner" do
before do
stub_feature_flags(invite_members_group_modal: true)
group.add_owner(user)
end
it_behaves_like "when group membership is unlocked"
it_behaves_like "when group membership is locked"
end
context 'when feature flag :invite_members_group_modal is disabled' do
shared_examples "when group membership is unlocked" do
before do
group.update!(membership_lock: false)
visit(project_project_members_path(project))
end
it { expect(page).to have_link("Import members").and have_selector(".project-access-select") }
end
shared_examples 'when group membership is locked' do
before do
group.update!(membership_lock: true)
project.add_maintainer(user)
visit(project_project_members_path(project))
end
it { expect(page).to have_no_selector(".invite-users-form") }
it { expect(page).to have_selector(".invite-group-form") }
end
context "as project maintainer" do
before do
stub_feature_flags(invite_members_group_modal: false)
project.add_maintainer(user)
end
it_behaves_like "when group membership is unlocked"
it_behaves_like "when group membership is locked"
end
context "as group owner" do
before do
stub_feature_flags(invite_members_group_modal: false)
group.add_owner(user)
end
it_behaves_like "when group membership is unlocked"
it_behaves_like "when group membership is locked"
end
end
end
......@@ -46,19 +46,6 @@ RSpec.describe 'projects/project_members/index', :aggregate_failures do
expect(rendered).not_to have_content('You can invite')
expect(response).to render_template(partial: 'projects/_invite_members_modal')
end
context 'when modal is not enabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'renders as expected' do
render
expect(rendered).not_to have_content('Project members')
expect(response).not_to render_template(partial: 'projects/_invite_members_modal')
end
end
end
end
end
......
......@@ -777,9 +777,6 @@ msgstr ""
msgid "%{link_start}Add a license%{link_end} that you have received from GitLab Inc."
msgstr ""
msgid "%{link_start}Learn more%{link_end} about roles."
msgstr ""
msgid "%{link_start}Remove the %{draft_snippet} prefix%{link_end} from the title to allow this merge request to be merged when it's ready."
msgstr ""
......@@ -1827,9 +1824,6 @@ msgstr ""
msgid "Access denied: %{error}"
msgstr ""
msgid "Access expiration date"
msgstr ""
msgid "Access expires"
msgstr ""
......@@ -16609,9 +16603,6 @@ msgstr ""
msgid "GitLab logo"
msgstr ""
msgid "GitLab member or Email address"
msgstr ""
msgid "GitLab metadata URL"
msgstr ""
......@@ -17257,9 +17248,6 @@ msgstr ""
msgid "Group runners can be managed with the %{link}."
msgstr ""
msgid "Group sharing provides access to all group members (including members who inherited group membership from a parent group)."
msgstr ""
msgid "Group variables (inherited)"
msgstr ""
......@@ -20083,9 +20071,6 @@ msgstr ""
msgid "Invitation declined"
msgstr ""
msgid "Invite"
msgstr ""
msgid "Invite \"%{email}\" by email"
msgstr ""
......@@ -20101,12 +20086,6 @@ msgstr ""
msgid "Invite email has already been taken"
msgstr ""
msgid "Invite group"
msgstr ""
msgid "Invite member"
msgstr ""
msgid "Invite members"
msgstr ""
......@@ -33151,9 +33130,6 @@ msgstr ""
msgid "Select a file from the left sidebar to begin editing. Afterwards, you'll be able to commit your changes."
msgstr ""
msgid "Select a group to invite"
msgstr ""
msgid "Select a label"
msgstr ""
......
......@@ -29,7 +29,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, group: group)
group.add_member(developer_user, Resource::Members::AccessLevel::DEVELOPER)
end
......
......@@ -31,7 +31,6 @@ module QA
let(:two_fa_expected_text) { /The group settings for.*require you to enable Two-Factor Authentication for your account.*You need to do this before/ }
before do
Runtime::Feature.enable(:invite_members_group_modal, group: group)
group.add_member(developer_user, Resource::Members::AccessLevel::DEVELOPER)
end
......
......@@ -3,10 +3,6 @@
module QA
RSpec.describe 'Manage', :requires_admin do
describe 'Add project member' do
before do
Runtime::Feature.enable(:invite_members_group_modal)
end
it 'user adds project member', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347887' do
Flow::Login.sign_in
......
......@@ -28,7 +28,6 @@ module QA
end
before(:context) do
Runtime::Feature.enable(:invite_members_group_modal)
@user = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
end
......@@ -79,10 +78,6 @@ module QA
project&.remove_via_api!
group&.remove_via_api!
end
after(:context) do
Runtime::Feature.disable(:invite_members_group_modal)
end
end
end
end
......@@ -11,10 +11,6 @@ module QA
end
end
before do
Runtime::Feature.enable(:invite_members_group_modal, project: project)
end
let(:developer_user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:maintainer_user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
let(:tag_name) { 'v0.0.1' }
......
......@@ -16,7 +16,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal)
Flow::Login.sign_in
end
......
......@@ -18,8 +18,6 @@ module QA
describe 'check xss occurence in @mentions in issues', :requires_admin do
before do
Runtime::Feature.enable(:invite_members_group_modal)
Flow::Login.sign_in
project.add_member(user)
......
# frozen_string_literal: true
module QA
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
RSpec.describe 'Plan', :smoke, :reliable, :requires_admin do
RSpec.describe 'Plan', :smoke, :reliable do
describe 'mention' do
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:project) do
......@@ -14,7 +13,6 @@ module QA
before do
Flow::Login.sign_in
Runtime::Feature.enable(:invite_members_group_modal, project: project)
project.add_member(user)
......
......@@ -14,7 +14,6 @@ module QA
before do
Runtime::Feature.enable('real_time_issue_sidebar', project: project)
Runtime::Feature.enable('broadcast_issue_updates', project: project)
Runtime::Feature.enable(:invite_members_group_modal, project: project)
Flow::Login.sign_in
......@@ -25,7 +24,6 @@ module QA
after do
Runtime::Feature.disable('real_time_issue_sidebar', project: project)
Runtime::Feature.disable('broadcast_issue_updates', project: project)
Runtime::Feature.disable(:invite_members_group_modal, project: project)
end
it 'update without refresh', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347941' do
......
......@@ -19,7 +19,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, project: parent_project)
parent_project.add_member(user)
end
......
......@@ -38,7 +38,6 @@ module QA
before do
@event_count = get_audit_event_count(group)
Runtime::Feature.enable(:invite_members_group_modal)
end
let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
......@@ -100,7 +99,6 @@ module QA
context 'Add and remove project access', :requires_admin, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347912' do
before do
Runtime::Feature.enable(:invite_members_group_modal)
sign_in
project.visit!
......
# frozen_string_literal: true
module QA
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
RSpec.describe 'Manage', :group_saml, :orchestrated, :requires_admin do
RSpec.describe 'Manage', :group_saml, :orchestrated do
describe 'Group SAML SSO - Enforced SSO' do
include Support::API
......@@ -26,8 +25,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, group: group)
group.add_member(developer_user)
Flow::Saml.enable_saml_sso(group, saml_idp_service, enforce_sso: true)
......
......@@ -23,8 +23,6 @@ module QA
project.initialize_with_readme = true
end
Runtime::Feature.enable(:invite_members_group_modal, project: @project)
@project.add_member(@user)
@api_client = Runtime::API::Client.new(:gitlab, user: @user)
......
......@@ -2,8 +2,7 @@
module QA
RSpec.describe 'Manage' do
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
describe 'Group with members', :requires_admin do
describe 'Group with members' do
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:source_group_with_members) do
......@@ -32,8 +31,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal)
source_group_with_members.add_member(maintainer_user, Resource::Members::AccessLevel::MAINTAINER)
end
......
......@@ -36,10 +36,8 @@ module QA
it_behaves_like 'audit event', ["Added project"]
end
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
context "Add user access as guest", :requires_admin, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347906' do
context "Add user access as guest", testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347906' do
before do
Runtime::Feature.enable(:invite_members_group_modal)
project.visit!
Page::Project::Menu.perform(&:click_members)
......
# frozen_string_literal: true
module QA
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
RSpec.describe 'Plan', :reliable, :requires_admin do
RSpec.describe 'Plan', :reliable do
describe 'Read-only board configuration' do
let(:qa_user) do
Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
......@@ -13,8 +12,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, project: label_board_list.project)
Flow::Login.sign_in
label_board_list.project.add_member(qa_user, Resource::Members::AccessLevel::GUEST)
......
# frozen_string_literal: true
module QA
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
RSpec.describe 'Plan', :reliable, :requires_admin do
RSpec.describe 'Plan', :reliable do
describe 'Multiple assignees per issue' do
before do
Flow::Login.sign_in
......@@ -16,8 +15,6 @@ module QA
project.name = 'project-to-test-issue-with-multiple-assignees'
end
Runtime::Feature.enable(:invite_members_group_modal, project: project)
project.add_member(user_1)
project.add_member(user_2)
project.add_member(user_3)
......
# frozen_string_literal: true
module QA
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
RSpec.describe 'Plan', :reliable, :requires_admin do
RSpec.describe 'Plan', :reliable do
describe 'Multiple assignees per issue' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
......@@ -11,8 +10,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, project: project)
Flow::Login.sign_in
user_1 = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1)
......
......@@ -2,8 +2,7 @@
module QA
RSpec.describe 'Create' do
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
describe 'Approval rules', :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/215876', type: :flaky } do
describe 'Approval rules', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/215876', type: :flaky } do
let(:approver1) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:approver2) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
let(:project) do
......@@ -16,8 +15,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, project: project)
Runtime::Feature.enable(:invite_members_group_modal, group: project.group)
project.add_member(approver1)
project.group.add_member(approver2)
......
......@@ -2,8 +2,7 @@
module QA
RSpec.describe 'Create' do
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
describe 'Codeowners', :requires_admin do
describe 'Codeowners' do
# Create one user to be the assigned approver and another user who will not be an approver
let(:approver) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) }
let(:non_approver) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) }
......@@ -18,7 +17,6 @@ module QA
let(:branch_name) { 'protected-branch' }
before do
Runtime::Feature.enable(:invite_members_group_modal, project: project)
project.add_member(approver, Resource::Members::AccessLevel::DEVELOPER)
project.add_member(non_approver, Resource::Members::AccessLevel::DEVELOPER)
......
......@@ -26,7 +26,7 @@ module QA
@project = Resource::Project.fabricate_via_api! do |project|
project.name = "codeowners"
end
Runtime::Feature.enable(:invite_members_group_modal)
@project.visit!
Page::Project::Menu.perform(&:click_members)
......
......@@ -20,9 +20,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal, project: project)
Runtime::Feature.enable(:invite_members_group_modal, group: root_group)
group_or_project.add_member(approver, Resource::Members::AccessLevel::MAINTAINER)
Flow::Login.sign_in
......
......@@ -18,8 +18,6 @@ module QA
end
before do
Runtime::Feature.enable(:invite_members_group_modal)
group_or_project.add_member(approver, Resource::Members::AccessLevel::MAINTAINER)
Flow::Login.sign_in
......
......@@ -3,11 +3,8 @@
module QA
RSpec.describe 'Create' do
context 'Push Rules' do
# TODO: Remove :requires_admin meta when the `Runtime::Feature.enable` method call is removed
describe 'using non signed commits', :requires_admin do
describe 'using non signed commits' do
before(:context) do
Runtime::Feature.enable(:invite_members_group_modal)
prepare
@file_name_limitation = 'denied_file'
......
......@@ -38,12 +38,6 @@ RSpec.describe Groups::GroupMembersController do
expect(assigns(:invited_members).map(&:invite_email)).to match_array(invited.map(&:invite_email))
end
it 'assigns skip groups' do
get :index, params: { group_id: group }
expect(assigns(:skip_groups)).to match_array(group.related_group_ids)
end
it 'restricts search to one email' do
get :index, params: { group_id: group, search_invited: invited.first.invite_email }
......@@ -68,11 +62,10 @@ RSpec.describe Groups::GroupMembersController do
sign_in(user)
end
it 'does not assign invited members or skip_groups', :aggregate_failures do
it 'does not assign invited members' do
get :index, params: { group_id: group }
expect(assigns(:invited_members)).to be_nil
expect(assigns(:skip_groups)).to be_nil
end
end
......
......@@ -5,7 +5,6 @@ require 'spec_helper'
RSpec.describe "Admin::Projects" do
include Spec::Support::Helpers::Features::MembersHelpers
include Spec::Support::Helpers::Features::InviteMembersModalHelper
include Select2Helper
include Spec::Support::Helpers::ModalHelpers
let(:user) { create :user }
......@@ -117,18 +116,6 @@ RSpec.describe "Admin::Projects" do
expect(find_member_row(current_user)).to have_content('Developer')
end
context 'with the invite_members_group_modal feature flag disabled' do
it 'adds admin to the project as developer' do
stub_feature_flags(invite_members_group_modal: false)
visit project_project_members_path(project)
add_member_using_form(current_user.id, role: 'Developer')
expect(find_member_row(current_user)).to have_content('Developer')
end
end
end
describe 'admin removes themselves from the project', :js do
......@@ -153,19 +140,4 @@ RSpec.describe "Admin::Projects" do
expect(page).to have_current_path(dashboard_projects_path, ignore_query: true, url: false)
end
end
# temporary method for the form until the :invite_members_group_modal feature flag is
# enabled: https://gitlab.com/gitlab-org/gitlab/-/issues/247208
def add_member_using_form(id, role: 'Developer')
page.within '.invite-users-form' do
select2(id, from: '#user_ids', multiple: true)
fill_in 'expires_at', with: 5.days.from_now.to_date
find_field('expires_at').native.send_keys :enter
select(role, from: "access_level")
click_on 'Invite'
end
end
end
......@@ -14,34 +14,6 @@ RSpec.describe 'Groups > Members > Manage groups', :js do
sign_in(user)
end
context 'with invite_members_group_modal disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
context 'when group link does not exist' do
let_it_be(:group) { create(:group) }
let_it_be(:group_to_add) { create(:group) }
before do
group.add_owner(user)
group_to_add.add_owner(user)
visit group_group_members_path(group)
end
it 'can share group with group' do
add_group(group_to_add.id, 'Reporter')
click_groups_tab
page.within(first_row) do
expect(page).to have_content(group_to_add.name)
expect(page).to have_content('Reporter')
end
end
end
end
context 'when group link does not exist' do
it 'can share a group with group' do
group = create(:group)
......@@ -177,32 +149,14 @@ RSpec.describe 'Groups > Members > Manage groups', :js do
end
context 'when sharing with groups outside the hierarchy is enabled' do
context 'when the invite members group modal is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'shows groups within and outside the hierarchy in search results' do
visit group_group_members_path(group)
click_on 'Invite group'
click_on 'Search for a group'
expect(page).to have_text group_within_hierarchy.name
expect(page).to have_text group_outside_hierarchy.name
end
end
context 'when the invite members group modal is enabled' do
it 'shows groups within and outside the hierarchy in search results' do
visit group_group_members_path(group)
it 'shows groups within and outside the hierarchy in search results' do
visit group_group_members_path(group)
click_on 'Invite a group'
click_on 'Select a group'
click_on 'Invite a group'
click_on 'Select a group'
expect(page).to have_text group_within_hierarchy.name
expect(page).to have_text group_outside_hierarchy.name
end
expect(page).to have_text group_within_hierarchy.name
expect(page).to have_text group_outside_hierarchy.name
end
end
......@@ -211,45 +165,18 @@ RSpec.describe 'Groups > Members > Manage groups', :js do
group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: true)
end
context 'when the invite members group modal is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'shows only groups within the hierarchy in search results' do
visit group_group_members_path(group)
click_on 'Invite group'
click_on 'Search for a group'
expect(page).to have_text group_within_hierarchy.name
expect(page).not_to have_text group_outside_hierarchy.name
end
end
context 'when the invite members group modal is enabled' do
it 'shows only groups within the hierarchy in search results' do
visit group_group_members_path(group)
it 'shows only groups within the hierarchy in search results' do
visit group_group_members_path(group)
click_on 'Invite a group'
click_on 'Select a group'
click_on 'Invite a group'
click_on 'Select a group'
expect(page).to have_text group_within_hierarchy.name
expect(page).not_to have_text group_outside_hierarchy.name
end
expect(page).to have_text group_within_hierarchy.name
expect(page).not_to have_text group_outside_hierarchy.name
end
end
end
def add_group(id, role)
page.click_link 'Invite group'
page.within ".invite-group-form" do
select2(id, from: "#shared_with_group_id")
select(role, from: "shared_group_access")
click_button "Invite"
end
end
def click_groups_tab
expect(page).to have_link 'Groups'
click_link "Groups"
......
......@@ -15,42 +15,18 @@ RSpec.describe 'Groups > Members > Manage members' do
sign_in(user1)
end
shared_examples 'includes the correct Invite link' do |should_include, should_not_include|
it 'includes either the form or the modal trigger', :aggregate_failures do
shared_examples 'includes the correct Invite link' do |should_include|
it 'includes the modal trigger', :aggregate_failures do
group.add_owner(user1)
visit group_group_members_path(group)
expect(page).to have_selector(should_include)
expect(page).not_to have_selector(should_not_include)
end
end
shared_examples 'does not include either invite modal or either invite form' do
it 'does not include either of the invite members or invite group modal buttons', :aggregate_failures do
expect(page).not_to have_selector '.js-invite-members-modal'
expect(page).not_to have_selector '.js-invite-group-modal'
end
it 'does not include either of the invite users or invite group forms', :aggregate_failures do
expect(page).not_to have_selector '.invite-users-form'
expect(page).not_to have_selector '.invite-group-form'
end
end
context 'when Invite Members modal is enabled' do
it_behaves_like 'includes the correct Invite link', '.js-invite-members-trigger', '.invite-users-form'
it_behaves_like 'includes the correct Invite link', '.js-invite-group-trigger', '.invite-group-form'
end
context 'when Invite Members modal is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it_behaves_like 'includes the correct Invite link', '.invite-users-form', '.js-invite-members-trigger'
it_behaves_like 'includes the correct Invite link', '.invite-group-form', '.js-invite-group-trigger'
end
it_behaves_like 'includes the correct Invite link', '.js-invite-members-trigger'
it_behaves_like 'includes the correct Invite link', '.js-invite-group-trigger'
it 'update user to owner level', :js do
group.add_owner(user1)
......@@ -106,33 +82,6 @@ RSpec.describe 'Groups > Members > Manage members' do
expect(page).to have_content('Invite "undisclosed_email@gitlab.com" by email')
end
context 'when Invite Members modal is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'do not disclose email addresses', :js do
group.add_owner(user1)
create(:user, email: 'undisclosed_email@gitlab.com', name: "Jane 'invisible' Doe")
visit group_group_members_path(group)
find('.select2-container').click
select_input = find('.select2-input')
select_input.send_keys('@gitlab.com')
wait_for_requests
expect(page).to have_content('No matches found')
select_input.native.clear
select_input.send_keys('undisclosed_email@gitlab.com')
wait_for_requests
expect(page).to have_content('Invite "undisclosed_email@gitlab.com" by email')
end
end
it 'remove user from group', :js do
group.add_owner(user1)
group.add_developer(user2)
......@@ -205,30 +154,11 @@ RSpec.describe 'Groups > Members > Manage members' do
visit group_group_members_path(group)
end
it_behaves_like 'does not include either invite modal or either invite form'
it 'does not include a button on the members page list to manage or remove the existing member', :js, :aggregate_failures do
page.within(second_row) do
# Can not modify user2 role
expect(page).not_to have_button 'Developer'
# Can not remove user2
expect(page).not_to have_selector 'button[title="Remove member"]'
end
end
end
context 'when user is a guest and the :invite_members_group_modal feature flag is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
group.add_guest(user1)
group.add_developer(user2)
visit group_group_members_path(group)
it 'does not include either of the invite members or invite group modal buttons', :aggregate_failures do
expect(page).not_to have_selector '.js-invite-members-modal'
expect(page).not_to have_selector '.js-invite-group-modal'
end
it_behaves_like 'does not include either invite modal or either invite form'
it 'does not include a button on the members page list to manage or remove the existing member', :js, :aggregate_failures do
page.within(second_row) do
# Can not modify user2 role
......
......@@ -92,7 +92,6 @@ RSpec.describe 'Projects members', :js do
context 'with a group requester' do
before do
stub_feature_flags(invite_members_group_modal: false)
group.request_access(group_requester)
visit project_project_members_path(project)
end
......
......@@ -3,47 +3,33 @@
require 'spec_helper'
RSpec.describe 'Project > Members > Invite group', :js do
include Select2Helper
include ActionView::Helpers::DateHelper
include Spec::Support::Helpers::Features::MembersHelpers
include Spec::Support::Helpers::Features::InviteMembersModalHelper
let_it_be(:maintainer) { create(:user) }
using RSpec::Parameterized::TableSyntax
it 'displays the invite group button' do
project = create(:project, namespace: create(:group))
where(:invite_members_group_modal_enabled, :expected_invite_group_selector) do
true | 'button[data-qa-selector="invite_a_group_button"]' # rubocop:disable QA/SelectorUsage
false | '#invite-group-tab'
end
with_them do
before do
stub_feature_flags(invite_members_group_modal: invite_members_group_modal_enabled)
end
project.add_maintainer(maintainer)
sign_in(maintainer)
it 'displays either the invite group button or the form with tabs based on the feature flag' do
project = create(:project, namespace: create(:group))
visit project_project_members_path(project)
project.add_maintainer(maintainer)
sign_in(maintainer)
expect(page).to have_selector('button[data-test-id="invite-group-button"]')
end
visit project_project_members_path(project)
it 'does not display the button when visiting the page not signed in' do
project = create(:project, namespace: create(:group))
expect(page).to have_selector(expected_invite_group_selector)
end
visit project_project_members_path(project)
it 'does not display either the form or the button when visiting the page not signed in' do
project = create(:project, namespace: create(:group))
visit project_project_members_path(project)
expect(page).not_to have_selector(expected_invite_group_selector)
end
expect(page).not_to have_selector('button[data-test-id="invite-group-button"]')
end
describe 'Share with group lock' do
let(:invite_group_selector) { 'button[data-qa-selector="invite_a_group_button"]' } # rubocop:disable QA/SelectorUsage
let(:invite_group_selector) { 'button[data-test-id="invite-group-button"]' }
shared_examples 'the project can be shared with groups' do
it 'the "Invite a group" button exists' do
......@@ -72,27 +58,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
context 'when the group has "Share with group lock" disabled' do
it_behaves_like 'the project can be shared with groups'
it 'the project can be shared with another group when the feature flag invite_members_group_modal is disabled' do
stub_feature_flags(invite_members_group_modal: false)
visit project_project_members_path(project)
expect(page).not_to have_link 'Groups'
click_on 'invite-group-tab'
select2 group_to_share_with.id, from: '#link_group_id'
page.find('body').click
find('.btn-confirm').click
click_link 'Groups'
expect(members_table).to have_content(group_to_share_with.name)
end
it 'the project can be shared with another group when the feature flag invite_members_group_modal is enabled' do
stub_feature_flags(invite_members_group_modal: true)
it 'the project can be shared with another group' do
visit project_project_members_path(project)
expect(page).not_to have_link 'Groups'
......@@ -250,51 +216,6 @@ RSpec.describe 'Project > Members > Invite group', :js do
end
end
context 'when invite_members_group_modal feature disabled' do
let(:group_invite_dropdown) { find('#select2-results-2') }
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'does not show the groups inherited from projects', :aggregate_failures do
project.add_maintainer(maintainer)
public_sibbling_group.add_maintainer(maintainer)
visit project_project_members_path(project)
click_on 'Invite group'
click_on 'Search for a group'
wait_for_requests
expect(group_invite_dropdown).to have_text(public_membership_group.full_path)
expect(group_invite_dropdown).to have_text(public_sibbling_group.full_path)
expect(group_invite_dropdown).to have_text(private_membership_group.full_path)
expect(group_invite_dropdown).not_to have_text(public_sub_subgroup.full_path)
expect(group_invite_dropdown).not_to have_text(private_sibbling_group.full_path)
expect(group_invite_dropdown).not_to have_text(parent_group.full_path, exact: true)
expect(group_invite_dropdown).not_to have_text(project_group.full_path, exact: true)
end
it 'does not show the ancestors or project group', :aggregate_failures do
parent_group.add_maintainer(maintainer)
visit project_project_members_path(project)
click_on 'Invite group'
click_on 'Search for a group'
wait_for_requests
expect(group_invite_dropdown).to have_text(public_membership_group.full_path)
expect(group_invite_dropdown).to have_text(public_sub_subgroup.full_path)
expect(group_invite_dropdown).to have_text(public_sibbling_group.full_path)
expect(group_invite_dropdown).to have_text(private_sibbling_group.full_path)
expect(group_invite_dropdown).to have_text(private_membership_group.full_path)
expect(group_invite_dropdown).not_to have_text(parent_group.full_path, exact: true)
expect(group_invite_dropdown).not_to have_text(project_group.full_path, exact: true)
end
end
def expect_to_have_group(group)
expect(page).to have_selector("[entity-id='#{group.id}']")
end
......
......@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec.describe 'Projects > Settings > User manages project members' do
include Spec::Support::Helpers::Features::MembersHelpers
include Select2Helper
include Spec::Support::Helpers::ModalHelpers
let(:group) { create(:group, name: 'OpenSource') }
......@@ -57,28 +56,6 @@ RSpec.describe 'Projects > Settings > User manages project members' do
expect(find_member_row(user_mike)).to have_content('Reporter')
end
describe 'when the :invite_members_group_modal is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'imports a team from another project', :js do
project2.add_maintainer(user)
project2.add_reporter(user_mike)
visit(project_project_members_path(project))
page.within('.invite-users-form') do
click_link('Import')
end
select2(project2.id, from: '#source_project_id')
click_button('Import project members')
expect(find_member_row(user_mike)).to have_content('Reporter')
end
end
it 'shows all members of project shared group', :js do
group.add_owner(user)
group.add_developer(user_dmitriy)
......
......@@ -147,17 +147,6 @@ RSpec.describe InviteMembersHelper do
expect(helper.can_invite_members_for_project?(project)).to eq true
expect(helper).to have_received(:can?).with(owner, :admin_project_member, project)
end
context 'when feature flag is disabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'returns false', :aggregate_failures do
expect(helper.can_invite_members_for_project?(project)).to eq false
expect(helper).not_to have_received(:can?).with(owner, :admin_project_member, project)
end
end
end
context 'when the user can not manage project members' do
......
......@@ -10,7 +10,6 @@ RSpec.describe 'groups/group_members/index', :aggregate_failures do
allow(view).to receive(:group_members_app_data).and_return({})
allow(view).to receive(:current_user).and_return(user)
assign(:group, group)
assign(:group_member, build(:group_member, group: group))
end
context 'when user can invite members for the group' do
......@@ -18,42 +17,15 @@ RSpec.describe 'groups/group_members/index', :aggregate_failures do
group.add_owner(user)
end
context 'when modal is enabled' do
it 'renders as expected' do
render
expect(rendered).to have_content('Group members')
expect(rendered).to have_content('You can invite a new member')
expect(rendered).to have_selector('.js-invite-group-trigger')
expect(rendered).to have_selector('.js-invite-members-trigger')
expect(response).to render_template(partial: 'groups/_invite_members_modal')
expect(rendered).not_to have_selector('#invite-member-tab')
expect(rendered).not_to have_selector('#invite-group-tab')
expect(response).not_to render_template(partial: 'shared/members/_invite_group')
end
end
context 'when modal is not enabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'renders as expected' do
render
expect(rendered).to have_content('Group members')
expect(rendered).to have_content('You can invite a new member')
it 'renders as expected' do
render
expect(rendered).to have_selector('#invite-member-tab')
expect(rendered).to have_selector('#invite-group-tab')
expect(response).to render_template(partial: 'shared/members/_invite_group')
expect(rendered).to have_content('Group members')
expect(rendered).to have_content('You can invite a new member')
expect(rendered).not_to have_selector('.js-invite-group-trigger')
expect(rendered).not_to have_selector('.js-invite-members-trigger')
expect(response).not_to render_template(partial: 'groups/_invite_members_modal')
end
expect(rendered).to have_selector('.js-invite-group-trigger')
expect(rendered).to have_selector('.js-invite-members-trigger')
expect(response).to render_template(partial: 'groups/_invite_members_modal')
end
end
......
......@@ -11,7 +11,6 @@ RSpec.describe 'projects/project_members/index', :aggregate_failures do
allow(view).to receive(:project_members_app_data_json).and_return({})
allow(view).to receive(:current_user).and_return(user)
assign(:project, project)
assign(:project_member, build(:project_member, project: source))
end
context 'when user can invite members for the project' do
......@@ -44,38 +43,6 @@ RSpec.describe 'projects/project_members/index', :aggregate_failures do
end
end
end
context 'when modal is not enabled' do
before do
stub_feature_flags(invite_members_group_modal: false)
end
it 'renders as expected' do
render
expect(rendered).to have_content('Project members')
expect(rendered).to have_content('You can invite a new member')
expect(rendered).not_to have_selector('.js-invite-group-trigger')
expect(rendered).not_to have_selector('.js-invite-members-trigger')
expect(rendered).not_to have_content('Members can be added by project')
expect(response).not_to render_template(partial: 'projects/_invite_members_modal')
expect(response).to render_template(partial: 'shared/members/_invite_member')
end
context 'when project can not be shared' do
before do
project.namespace.share_with_group_lock = true
end
it 'renders as expected' do
render
expect(rendered).to have_content('Project members')
expect(rendered).to have_content('You can invite a new member')
expect(response).not_to render_template(partial: 'projects/_invite_members_modal')
end
end
end
end
context 'when user can not invite members or group for the project' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment