Commit f6329a79 authored by Jackie Fraser's avatar Jackie Fraser

Fix import project link on members page form

Removes the can_import_members? EE ability check from the check
for whether to display the "Invite members" and "Invite a group"
modal buttons.
parent 0928d733
...@@ -8,7 +8,7 @@ module InviteMembersHelper ...@@ -8,7 +8,7 @@ module InviteMembersHelper
end end
def can_invite_members_for_project?(project) def can_invite_members_for_project?(project)
Feature.enabled?(:invite_members_group_modal, project.group) && can_import_members? Feature.enabled?(:invite_members_group_modal, project.group) && can_manage_project_members?(project)
end end
def directly_invite_members? def directly_invite_members?
......
...@@ -52,9 +52,11 @@ RSpec.describe 'Projects > Settings > User manages project members' do ...@@ -52,9 +52,11 @@ RSpec.describe 'Projects > Settings > User manages project members' do
end end
describe 'when the :invite_members_group_modal is disabled' do describe 'when the :invite_members_group_modal is disabled' do
it 'imports a team from another project', :js do before do
stub_feature_flags(invite_members_group_modal: false) stub_feature_flags(invite_members_group_modal: false)
end
it 'imports a team from another project', :js do
project2.add_maintainer(user) project2.add_maintainer(user)
project2.add_reporter(user_mike) project2.add_reporter(user_mike)
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
require "spec_helper" require "spec_helper"
RSpec.describe InviteMembersHelper do RSpec.describe InviteMembersHelper do
include Devise::Test::ControllerHelpers
let_it_be(:project) { create(:project) } let_it_be(:project) { create(:project) }
let_it_be(:developer) { create(:user, developer_projects: [project]) } let_it_be(:developer) { create(:user, developer_projects: [project]) }
...@@ -29,18 +31,19 @@ RSpec.describe InviteMembersHelper do ...@@ -29,18 +31,19 @@ RSpec.describe InviteMembersHelper do
context 'with project' do context 'with project' do
before do before do
allow(helper).to receive(:current_user) { owner }
assign(:project, project) assign(:project, project)
end end
describe "#can_invite_members_for_project?" do describe "#can_invite_members_for_project?" do
context 'when the user can_import_members' do context 'when the user can_manage_project_members' do
before do before do
allow(helper).to receive(:can_import_members?).and_return(true) allow(helper).to receive(:can_manage_project_members?).and_return(true)
end end
it 'returns true' do it 'returns true' do
expect(helper.can_invite_members_for_project?(project)).to eq true expect(helper.can_invite_members_for_project?(project)).to eq true
expect(helper).to have_received(:can_import_members?) expect(helper).to have_received(:can_manage_project_members?)
end end
context 'when feature flag is disabled' do context 'when feature flag is disabled' do
...@@ -50,14 +53,14 @@ RSpec.describe InviteMembersHelper do ...@@ -50,14 +53,14 @@ RSpec.describe InviteMembersHelper do
it 'returns false' do it 'returns false' do
expect(helper.can_invite_members_for_project?(project)).to eq false expect(helper.can_invite_members_for_project?(project)).to eq false
expect(helper).not_to have_received(:can_import_members?) expect(helper).not_to have_received(:can_manage_project_members?)
end end
end end
end end
context 'when the user can not invite members' do context 'when the user can not manage project members' do
before do before do
expect(helper).to receive(:can_import_members?).and_return(false) expect(helper).to receive(:can_manage_project_members?).and_return(false)
end end
it 'returns false' do it 'returns false' do
...@@ -134,7 +137,7 @@ RSpec.describe InviteMembersHelper do ...@@ -134,7 +137,7 @@ RSpec.describe InviteMembersHelper do
allow(helper).to receive(:current_user) { user } allow(helper).to receive(:current_user) { user }
end end
context 'when the user can_import_members' do context 'when the user can admin_group_member' do
before do before do
allow(helper).to receive(:can?).with(user, :admin_group_member, group).and_return(true) allow(helper).to receive(:can?).with(user, :admin_group_member, group).and_return(true)
end end
...@@ -158,7 +161,7 @@ RSpec.describe InviteMembersHelper do ...@@ -158,7 +161,7 @@ RSpec.describe InviteMembersHelper do
end end
end end
context 'when the user can not invite members' do context 'when the user can not admin_group_member' do
before do before do
expect(helper).to receive(:can?).with(user, :admin_group_member, group).and_return(false) expect(helper).to receive(:can?).with(user, :admin_group_member, group).and_return(false)
end end
......
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