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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
57b5612a
Commit
57b5612a
authored
Dec 26, 2016
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the "Groups" option from the settings gear
Fixed more tests
parent
ad58dec2
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
18 deletions
+15
-18
app/controllers/projects/settings/members_controller.rb
app/controllers/projects/settings/members_controller.rb
+2
-2
app/finders/members_finder.rb
app/finders/members_finder.rb
+5
-5
app/views/layouts/nav/_project_settings.html.haml
app/views/layouts/nav/_project_settings.html.haml
+0
-5
app/views/projects/settings/members/show.html.haml
app/views/projects/settings/members/show.html.haml
+3
-1
spec/controllers/projects/project_members_controller_spec.rb
spec/controllers/projects/project_members_controller_spec.rb
+2
-2
spec/features/projects/group_links_spec.rb
spec/features/projects/group_links_spec.rb
+1
-1
spec/features/projects/members/group_links_spec.rb
spec/features/projects/members/group_links_spec.rb
+2
-2
No files found.
app/controllers/projects/settings/members_controller.rb
View file @
57b5612a
...
@@ -16,14 +16,14 @@ module Projects
...
@@ -16,14 +16,14 @@ module Projects
@group_links
=
@project
.
project_group_links
.
all
@group_links
=
@project
.
project_group_links
.
all
@skip_groups
=
@group_links
.
pluck
(
:group_id
)
@skip_groups
=
@group_links
.
pluck
(
:group_id
)
@skip_groups
<<
@project
.
namespace_id
unless
project
.
personal?
@skip_groups
<<
@project
.
namespace_id
unless
@
project
.
personal?
if
group
if
group
# We need `.where.not(user_id: nil)` here otherwise when a group has an
# We need `.where.not(user_id: nil)` here otherwise when a group has an
# invitee, it would make the following query return 0 rows since a NULL
# invitee, it would make the following query return 0 rows since a NULL
# user_id would be present in the subquery
# user_id would be present in the subquery
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
group_members
=
MembersFinder
.
new
(
@project
,
@group
)
group_members
=
MembersFinder
.
new
(
@project
_members
,
group
).
execute
(
current_user
)
end
end
if
params
[
:search
].
present?
if
params
[
:search
].
present?
...
...
app/finders/members_finder.rb
View file @
57b5612a
class
MembersFinder
<
Projects
::
ApplicationController
class
MembersFinder
<
Projects
::
ApplicationController
def
initialize
(
project_members
,
group
)
def
initialize
(
project_members
,
project_
group
)
@project_members
=
project_members
@project_members
=
project_members
@
group
=
group
@
project_group
=
project_
group
end
end
def
execute
def
execute
(
current_user
)
non_null_user_ids
=
@project_members
.
where
.
not
(
user_id:
nil
).
select
(
:user_id
)
non_null_user_ids
=
@project_members
.
where
.
not
(
user_id:
nil
).
select
(
:user_id
)
group_members
=
@group
.
group_members
.
where
.
not
(
user_id:
non_null_user_ids
)
group_members
=
@
project_
group
.
group_members
.
where
.
not
(
user_id:
non_null_user_ids
)
group_members
=
group_members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@
group
)
group_members
=
group_members
.
non_invite
unless
can?
(
current_user
,
:admin_group
,
@project_
group
)
group_members
group_members
end
end
end
end
app/views/layouts/nav/_project_settings.html.haml
View file @
57b5612a
...
@@ -4,11 +4,6 @@
...
@@ -4,11 +4,6 @@
%span
%span
Members
Members
-
if
can_edit
-
if
can_edit
-
if
@project
.
allowed_to_share_with_group?
=
nav_link
(
controller: :group_links
)
do
=
link_to
namespace_project_group_links_path
(
@project
.
namespace
,
@project
),
title:
"Groups"
do
%span
Groups
=
nav_link
(
controller: :deploy_keys
)
do
=
nav_link
(
controller: :deploy_keys
)
do
=
link_to
namespace_project_deploy_keys_path
(
@project
.
namespace
,
@project
),
title:
'Deploy Keys'
do
=
link_to
namespace_project_deploy_keys_path
(
@project
.
namespace
,
@project
),
title:
'Deploy Keys'
do
%span
%span
...
...
app/views/projects/settings/members/show.html.haml
View file @
57b5612a
-
page_title
"Members"
-
page_title
"Members"
=
render
"projects/project_members/index"
=
render
"projects/project_members/index"
=
render
"projects/group_links/index"
-
if
can?
(
current_user
,
:admin_project
,
@project
)
-
if
@project
.
allowed_to_share_with_group?
=
render
"projects/group_links/index"
spec/controllers/projects/project_members_controller_spec.rb
View file @
57b5612a
...
@@ -5,11 +5,11 @@ describe Projects::ProjectMembersController do
...
@@ -5,11 +5,11 @@ describe Projects::ProjectMembersController do
let
(
:project
)
{
create
(
:empty_project
,
:public
,
:access_requestable
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
,
:access_requestable
)
}
describe
'GET index'
do
describe
'GET index'
do
it
'
redirects to settings/members with
302 status code'
do
it
'
should have the settings/members address with a
302 status code'
do
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
get
:index
,
namespace_id:
project
.
namespace
,
project_id:
project
expect
(
response
).
to
have_http_status
(
302
)
expect
(
response
).
to
have_http_status
(
302
)
expect
(
response
).
to
redirect_to
(
namespace_project_settings_members_path
(
project
.
namespace
,
project
)
)
expect
(
response
.
location
).
to
include
namespace_project_settings_members_path
(
project
.
namespace
,
project
)
end
end
end
end
...
...
spec/features/projects/group_links_spec.rb
View file @
57b5612a
...
@@ -14,7 +14,7 @@ feature 'Project group links', feature: true, js: true do
...
@@ -14,7 +14,7 @@ feature 'Project group links', feature: true, js: true do
context
'setting an expiration date for a group link'
do
context
'setting an expiration date for a group link'
do
before
do
before
do
visit
namespace_project_
group_link
s_path
(
project
.
namespace
,
project
)
visit
namespace_project_
settings_member
s_path
(
project
.
namespace
,
project
)
select2
group
.
id
,
from:
'#link_group_id'
select2
group
.
id
,
from:
'#link_group_id'
fill_in
'expires_at'
,
with:
(
Time
.
current
+
4.5
.
days
).
strftime
(
'%Y-%m-%d'
)
fill_in
'expires_at'
,
with:
(
Time
.
current
+
4.5
.
days
).
strftime
(
'%Y-%m-%d'
)
...
...
spec/features/projects/members/group_links_spec.rb
View file @
57b5612a
...
@@ -12,7 +12,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
...
@@ -12,7 +12,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
@group_link
=
create
(
:project_group_link
,
project:
project
,
group:
group
)
@group_link
=
create
(
:project_group_link
,
project:
project
,
group:
group
)
login_as
(
user
)
login_as
(
user
)
visit
namespace_project_
project
_members_path
(
project
.
namespace
,
project
)
visit
namespace_project_
settings
_members_path
(
project
.
namespace
,
project
)
end
end
it
'updates group access level'
do
it
'updates group access level'
do
...
@@ -24,7 +24,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
...
@@ -24,7 +24,7 @@ feature 'Projects > Members > Anonymous user sees members', feature: true, js: t
wait_for_ajax
wait_for_ajax
visit
namespace_project_
project
_members_path
(
project
.
namespace
,
project
)
visit
namespace_project_
settings
_members_path
(
project
.
namespace
,
project
)
expect
(
first
(
'.group_member'
)).
to
have_content
(
'Guest'
)
expect
(
first
(
'.group_member'
)).
to
have_content
(
'Guest'
)
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