diff options
author | Rémy Coutable <remy@rymai.me> | 2018-02-16 14:00:25 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-02-27 18:02:22 +0300 |
commit | e82f629be4b9c91e2611095cd4296e487ed137ef (patch) | |
tree | fc8cb097f0b8e37c2e6fe785cf114a621e1f6b35 /app/controllers | |
parent | bf41063679b25371b2e64542f2f469b38502edf6 (diff) |
Move the #update action from Project/Member controllers to the MembershipActions concern
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/concerns/membership_actions.rb | 12 | ||||
-rw-r--r-- | app/controllers/groups/group_members_controller.rb | 8 | ||||
-rw-r--r-- | app/controllers/projects/project_members_controller.rb | 8 |
3 files changed, 12 insertions, 16 deletions
diff --git a/app/controllers/concerns/membership_actions.rb b/app/controllers/concerns/membership_actions.rb index a6f1509b451..82fdb797d2a 100644 --- a/app/controllers/concerns/membership_actions.rb +++ b/app/controllers/concerns/membership_actions.rb @@ -14,6 +14,18 @@ module MembershipActions end end + def update + member = membershipable.members_and_requesters.find(params[:id]) + @member = Members::UpdateService + .new(membershipable, current_user, member_params) + .execute(member) + .present(current_user: current_user) + + respond_to do |format| + format.js { render 'shared/members/update' } + end + end + def destroy member = membershipable.members_and_requesters.find(params[:id]) Members::DestroyService.new(membershipable, current_user, params) diff --git a/app/controllers/groups/group_members_controller.rb b/app/controllers/groups/group_members_controller.rb index 1efd07835e2..23ade14edfd 100644 --- a/app/controllers/groups/group_members_controller.rb +++ b/app/controllers/groups/group_members_controller.rb @@ -27,14 +27,6 @@ class Groups::GroupMembersController < Groups::ApplicationController @group_member = @group.group_members.new end - def update - member = @group.members_and_requesters.find(params[:id]) - @group_member = Members::UpdateService - .new(@group, current_user, member_params) - .execute(member) - .present(current_user: current_user) - end - def resend_invite redirect_path = group_group_members_path(@group) diff --git a/app/controllers/projects/project_members_controller.rb b/app/controllers/projects/project_members_controller.rb index 06388055d52..006d5df767c 100644 --- a/app/controllers/projects/project_members_controller.rb +++ b/app/controllers/projects/project_members_controller.rb @@ -26,14 +26,6 @@ class Projects::ProjectMembersController < Projects::ApplicationController @project_member = @project.project_members.new end - def update - member = @project.members_and_requesters.find(params[:id]) - @project_member = Members::UpdateService - .new(@project, current_user, member_params) - .execute(member) - .present(current_user: current_user) - end - def resend_invite redirect_path = project_project_members_path(@project) |