Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
fae745c3
Commit
fae745c3
authored
May 10, 2019
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve CE/EE diffs in new proj member import
Part of single codebase changes.
parent
4828ef52
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+4
-0
app/views/projects/project_members/_new_project_member.html.haml
...ws/projects/project_members/_new_project_member.html.haml
+2
-1
spec/helpers/projects_helper_spec.rb
spec/helpers/projects_helper_spec.rb
+20
-0
No files found.
app/helpers/projects_helper.rb
View file @
fae745c3
...
...
@@ -315,6 +315,10 @@ module ProjectsHelper
)
%
{
default_label:
default_label
}
end
def
can_import_members?
Ability
.
allowed?
(
current_user
,
:admin_project_member
,
@project
)
end
private
def
get_project_nav_tabs
(
project
,
current_user
)
...
...
app/views/projects/project_members/_new_project_member.html.haml
View file @
fae745c3
...
...
@@ -19,4 +19,5 @@
=
text_field_tag
:expires_at
,
nil
,
class:
'form-control js-access-expiration-date'
,
placeholder:
'Expiration date'
%i
.clear-icon.js-clear-input
=
f
.
submit
_
(
"Add to project"
),
class:
"btn btn-success qa-add-member-button"
-
if
can_import_members?
=
link_to
_
(
"Import"
),
import_project_project_members_path
(
@project
),
class:
"btn btn-default"
,
title:
_
(
"Import members from another project"
)
spec/helpers/projects_helper_spec.rb
View file @
fae745c3
...
...
@@ -799,4 +799,24 @@ describe ProjectsHelper do
it
{
is_expected
.
to
eq
(
result
)
}
end
end
describe
'#can_import_members?'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:owner
)
{
project
.
owner
}
before
do
helper
.
instance_variable_set
(
:@project
,
project
)
end
it
'returns false if user cannot admin_project_member'
do
allow
(
helper
).
to
receive
(
:current_user
)
{
user
}
expect
(
helper
.
can_import_members?
).
to
eq
false
end
it
'returns true if user can admin_project_member'
do
allow
(
helper
).
to
receive
(
:current_user
)
{
owner
}
expect
(
helper
.
can_import_members?
).
to
eq
true
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment