summaryrefslogtreecommitdiff
path: root/app/controllers/groups
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-29 14:11:37 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-05-29 14:12:30 +0200
commitcef746dc94347d65af6d953eb03223d16e3c4019 (patch)
tree30faf6e08a20e98c5c8c680f4ea752228a2a117f /app/controllers/groups
parentaa97325deae515f45c047df3640d7b1f07247038 (diff)
downloadgitlab-ce-cef746dc94347d65af6d953eb03223d16e3c4019.tar.gz
User should be able to leave group. If not - show him proper message
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/groups')
-rw-r--r--app/controllers/groups/group_members_controller.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb
index a11c554a2af..040255f08e6 100644
--- a/app/controllers/groups/group_members_controller.rb
+++ b/app/controllers/groups/group_members_controller.rb
@@ -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