diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-29 16:35:05 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-05-29 16:35:05 +0300 |
commit | 394fe7614c3d8507b79ca41419f11bcde906ccae (patch) | |
tree | c6ea3084085d581edf8a2f9079850897e55741cc /app/controllers | |
parent | 907bbb2b05860be401c77b305721b35a2850ea71 (diff) | |
parent | 85de253ee10aa7821a212270a1940c6205533d38 (diff) |
Merge branch 'leave-group' into 'master'
User should be able to leave group. If not - show him proper message
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
See merge request !743
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 6 |
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 |