diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-13 18:28:33 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-03-15 15:52:28 +0300 |
commit | 84371de01f3ce7bab334539a93734658528736ec (patch) | |
tree | 25f7a74f039d60c2a3e377d12d45876419ae3829 /app/controllers/groups/group_members_controller.rb | |
parent | 224187ffb96283cbf42953a30c116931c03562a2 (diff) |
Move group leave action from dashboard/groups to groups/group_members.
Diffstat (limited to 'app/controllers/groups/group_members_controller.rb')
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index d3d6ce1ca2c..2df51c97a22 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -46,6 +46,17 @@ class Groups::GroupMembersController < Groups::ApplicationController end end + def leave + @group_member = @group.group_members.where(user_id: current_user.id).first + + if can?(current_user, :destroy_group_member, @group_member) + @group_member.destroy + redirect_to(dashboard_groups_path, info: "You left #{group.name} group.") + else + return render_403 + end + end + protected def group |