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
Tatuya Kamada
gitlab-ce
Commits
c47d8ab6
Commit
c47d8ab6
authored
Nov 19, 2016
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed leave buttons from settings dropdowns
Updated specs
parent
fc035011
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
36 additions
and
42 deletions
+36
-42
app/views/layouts/nav/_group_settings.html.haml
app/views/layouts/nav/_group_settings.html.haml
+2
-10
app/views/layouts/nav/_project.html.haml
app/views/layouts/nav/_project.html.haml
+4
-13
app/views/shared/members/_access_request_buttons.html.haml
app/views/shared/members/_access_request_buttons.html.haml
+16
-10
changelogs/unreleased/23305-leave-project-and-leave-group-should-be-buttons.yml
...23305-leave-project-and-leave-group-should-be-buttons.yml
+5
-0
spec/features/groups/members/last_owner_cannot_leave_group_spec.rb
...ures/groups/members/last_owner_cannot_leave_group_spec.rb
+2
-2
spec/features/groups/members/member_leaves_group_spec.rb
spec/features/groups/members/member_leaves_group_spec.rb
+1
-1
spec/features/groups/members/user_requests_access_spec.rb
spec/features/groups/members/user_requests_access_spec.rb
+1
-1
spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb
...s/members/group_member_cannot_leave_group_project_spec.rb
+1
-1
spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb
.../group_requester_cannot_request_access_to_project_spec.rb
+1
-1
spec/features/projects/members/member_leaves_project_spec.rb
spec/features/projects/members/member_leaves_project_spec.rb
+1
-1
spec/features/projects/members/owner_cannot_leave_project_spec.rb
...tures/projects/members/owner_cannot_leave_project_spec.rb
+2
-2
No files found.
app/views/layouts/nav/_group_settings.html.haml
View file @
c47d8ab6
-
if
current_user
-
can_admin_group
=
can?
(
current_user
,
:admin_group
,
@group
)
-
can_edit
=
can?
(
current_user
,
:admin_group
,
@group
)
-
member
=
@group
.
members
.
find_by
(
user_id:
current_user
.
id
)
-
can_leave
=
member
&&
can?
(
current_user
,
:destroy_group_member
,
member
)
-
if
can_admin_group
||
can_edit
||
can_leave
-
if
can_admin_group
||
can_edit
.controls
.dropdown.group-settings-dropdown
%a
.dropdown-new.btn.btn-default
#group-settings-button
{
href:
'#'
,
'data-toggle'
=>
'dropdown'
}
...
...
@@ -14,13 +12,7 @@
-
if
can_admin_group
=
nav_link
(
path:
'groups#projects'
)
do
=
link_to
'Projects'
,
projects_group_path
(
@group
),
title:
'Projects'
-
if
(
can_edit
||
can_leave
)
&&
can_admin_group
-
if
can_edit
&&
can_admin_group
%li
.divider
-
if
can_edit
%li
=
link_to
'Edit Group'
,
edit_group_path
(
@group
)
-
if
can_leave
%li
=
link_to
polymorphic_path
([
:leave
,
@group
,
:members
]),
data:
{
confirm:
leave_confirmation_message
(
@group
)
},
method: :delete
,
title:
'Leave group'
do
Leave Group
app/views/layouts/nav/_project.html.haml
View file @
c47d8ab6
...
...
@@ -6,23 +6,14 @@
=
icon
(
'caret-down'
)
%ul
.dropdown-menu.dropdown-menu-align-right
-
can_edit
=
can?
(
current_user
,
:admin_project
,
@project
)
-# We don't use @project.team.find_member because it searches for group members too...
-
member
=
@project
.
members
.
find_by
(
user_id:
current_user
.
id
)
-
can_leave
=
member
&&
can?
(
current_user
,
:destroy_project_member
,
member
)
=
render
'layouts/nav/project_settings'
,
can_edit:
can_edit
-
if
can_edit
||
can_leave
-
if
can_edit
%li
.divider
-
if
can_edit
%li
=
link_to
edit_project_path
(
@project
)
do
Edit Project
-
if
can_leave
%li
=
link_to
polymorphic_path
([
:leave
,
@project
,
:members
]),
data:
{
confirm:
leave_confirmation_message
(
@project
)
},
method: :delete
,
title:
'Leave project'
do
Leave Project
%li
=
link_to
edit_project_path
(
@project
)
do
Edit Project
.scrolling-tabs-container
{
class:
nav_control_class
}
.fade-left
...
...
app/views/shared/members/_access_request_buttons.html.haml
View file @
c47d8ab6
-
if
can?
(
current_user
,
:request_access
,
source
)
-
if
requester
=
source
.
requesters
.
find_by
(
user_id:
current_user
.
id
)
=
link_to
'Withdraw Access Request'
,
polymorphic_path
([
:leave
,
source
,
:members
]),
method: :delete
,
data:
{
confirm:
remove_member_message
(
requester
)
},
class:
'btn'
-
else
=
link_to
'Request Access'
,
polymorphic_path
([
:request_access
,
source
,
:members
]),
method: :post
,
class:
'btn'
-
model_name
=
source
.
model_name
.
to_s
.
downcase
-
if
can?
(
current_user
,
:"destroy_
#{
model_name
}
_member"
,
source
.
members
.
find_by
(
user_id:
current_user
.
id
))
=
link_to
"Leave
#{
model_name
}
"
,
polymorphic_path
([
:leave
,
source
,
:members
]),
method: :delete
,
data:
{
confirm:
leave_confirmation_message
(
source
)
},
class:
'btn'
-
elsif
requester
=
source
.
requesters
.
find_by
(
user_id:
current_user
.
id
)
=
link_to
'Withdraw Access Request'
,
polymorphic_path
([
:leave
,
source
,
:members
]),
method: :delete
,
data:
{
confirm:
remove_member_message
(
requester
)
},
class:
'btn'
-
elsif
source
.
request_access_enabled
&&
can?
(
current_user
,
:request_access
,
source
)
=
link_to
'Request Access'
,
polymorphic_path
([
:request_access
,
source
,
:members
]),
method: :post
,
class:
'btn'
changelogs/unreleased/23305-leave-project-and-leave-group-should-be-buttons.yml
0 → 100644
View file @
c47d8ab6
---
title
:
Moved Leave Project and Leave Group buttons to access_request_buttons from
the settings dropdown
merge_request
:
7600
author
:
spec/features/groups/members/last_owner_cannot_leave_group_spec.rb
View file @
c47d8ab6
...
...
@@ -10,7 +10,7 @@ feature 'Groups > Members > Last owner cannot leave group', feature: true do
visit
group_path
(
group
)
end
scenario
'user does not see a "Leave
G
roup" link'
do
expect
(
page
).
not_to
have_content
'Leave
G
roup'
scenario
'user does not see a "Leave
g
roup" link'
do
expect
(
page
).
not_to
have_content
'Leave
g
roup'
end
end
spec/features/groups/members/member_leaves_group_spec.rb
View file @
c47d8ab6
...
...
@@ -13,7 +13,7 @@ feature 'Groups > Members > Member leaves group', feature: true do
end
scenario
'user leaves group'
do
click_link
'Leave
G
roup'
click_link
'Leave
g
roup'
expect
(
current_path
).
to
eq
(
dashboard_groups_path
)
expect
(
group
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
...
...
spec/features/groups/members/user_requests_access_spec.rb
View file @
c47d8ab6
...
...
@@ -29,7 +29,7 @@ feature 'Groups > Members > User requests access', feature: true do
expect
(
page
).
to
have_content
'Your request for access has been queued for review.'
expect
(
page
).
to
have_content
'Withdraw Access Request'
expect
(
page
).
not_to
have_content
'Leave
G
roup'
expect
(
page
).
not_to
have_content
'Leave
g
roup'
end
scenario
'user does not see private projects'
do
...
...
spec/features/projects/members/group_member_cannot_leave_group_project_spec.rb
View file @
c47d8ab6
...
...
@@ -12,6 +12,6 @@ feature 'Projects > Members > Group member cannot leave group project', feature:
end
scenario
'user does not see a "Leave project" link'
do
expect
(
page
).
not_to
have_content
'Leave
P
roject'
expect
(
page
).
not_to
have_content
'Leave
p
roject'
end
end
spec/features/projects/members/group_requester_cannot_request_access_to_project_spec.rb
View file @
c47d8ab6
require
'spec_helper'
feature
'Projects > Members > Group requester cannot request access to project'
,
feature:
true
do
feature
'Projects > Members > Group requester cannot request access to project'
,
feature:
true
,
js:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:owner
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
,
:access_requestable
)
}
...
...
spec/features/projects/members/member_leaves_project_spec.rb
View file @
c47d8ab6
...
...
@@ -11,7 +11,7 @@ feature 'Projects > Members > Member leaves project', feature: true do
end
scenario
'user leaves project'
do
click_link
'Leave
P
roject'
click_link
'Leave
p
roject'
expect
(
current_path
).
to
eq
(
dashboard_projects_path
)
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
...
...
spec/features/projects/members/owner_cannot_leave_project_spec.rb
View file @
c47d8ab6
...
...
@@ -8,7 +8,7 @@ feature 'Projects > Members > Owner cannot leave project', feature: true do
visit
namespace_project_path
(
project
.
namespace
,
project
)
end
scenario
'user does not see a "Leave
P
roject" link'
do
expect
(
page
).
not_to
have_content
'Leave
P
roject'
scenario
'user does not see a "Leave
p
roject" link'
do
expect
(
page
).
not_to
have_content
'Leave
p
roject'
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