diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-03-13 16:28:33 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-03-15 13:52:28 +0100 |
commit | 84371de01f3ce7bab334539a93734658528736ec (patch) | |
tree | 25f7a74f039d60c2a3e377d12d45876419ae3829 /app/controllers | |
parent | 224187ffb96283cbf42953a30c116931c03562a2 (diff) | |
download | gitlab-ce-84371de01f3ce7bab334539a93734658528736ec.tar.gz |
Move group leave action from dashboard/groups to groups/group_members.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/dashboard/groups_controller.rb | 18 | ||||
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 11 |
2 files changed, 12 insertions, 17 deletions
diff --git a/app/controllers/dashboard/groups_controller.rb b/app/controllers/dashboard/groups_controller.rb index b827639978c..ed14f4e1f3b 100644 --- a/app/controllers/dashboard/groups_controller.rb +++ b/app/controllers/dashboard/groups_controller.rb @@ -1,21 +1,5 @@ class Dashboard::GroupsController < ApplicationController def index - @user_groups = current_user.group_members.page(params[:page]).per(PER_PAGE) - end - - def leave - @users_group = group.group_members.where(user_id: current_user.id).first - if can?(current_user, :destroy, @users_group) - @users_group.destroy - redirect_to(dashboard_groups_path, info: "You left #{group.name} group.") - else - return render_403 - end - end - - private - - def group - @group ||= Group.find_by(path: params[:id]) + @group_members = current_user.group_members.page(params[:page]).per(PER_PAGE) end end 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 |