Skip to content
Snippets Groups Projects
Commit cef746dc authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

User should be able to leave group. If not - show him proper message

parent aa97325d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -29,6 +29,7 @@ v 7.12.0 (unreleased)
- Clarify navigation labels for Project Settings and Group Settings.
- Move user avatar and logout button to sidebar
- You can not remove user if he/she is an only owner of group
- User should be able to leave group. If not - show him proper message
 
v 7.11.4
- Fix missing bullets when creating lists
Loading
Loading
Loading
Loading
@@ -66,7 +66,11 @@ class Groups::GroupMembersController < Groups::ApplicationController
@group_member.destroy
redirect_to(dashboard_groups_path, notice: "You left #{group.name} group.")
else
return render_403
if @group.last_owner?(current_user)
redirect_to(dashboard_groups_path, alert: "You can not leave #{group.name} group because you're the last owner. Transfer or delete the group.")
else
return render_403
end
end
end
 
Loading
Loading
Loading
Loading
@@ -23,10 +23,9 @@
%i.fa.fa-cogs
Settings
 
- if can?(current_user, :destroy_group_member, group_member)
= link_to leave_group_group_members_path(group), data: { confirm: leave_group_message(group.name) }, method: :delete, class: "btn-sm btn btn-grouped", title: 'Remove user from group' do
%i.fa.fa-sign-out
Leave
= link_to leave_group_group_members_path(group), data: { confirm: leave_group_message(group.name) }, method: :delete, class: "btn-sm btn btn-grouped", title: 'Leave this group' do
%i.fa.fa-sign-out
Leave
 
= image_tag group_icon(group), class: "avatar s40 avatar-tile"
= link_to group, class: 'group-name' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment