Commit e82f629b authored by Rémy Coutable's avatar Rémy Coutable

Move the #update action from Project/Member controllers to the MembershipActions concern

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent bf410636
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
:plain
var $listItem = $('#{escape_javascript(render('shared/members/member', member: @group_member))}');
$("##{dom_id(@group_member)} .list-item-name").replaceWith($listItem.find('.list-item-name'));
gl.utils.localTimeAgo($('.js-timeago'), $("##{dom_id(@group_member)}"));
:plain
var $listItem = $('#{escape_javascript(render('shared/members/member', member: @project_member))}');
$("##{dom_id(@project_member)} .list-item-name").replaceWith($listItem.find('.list-item-name'));
gl.utils.localTimeAgo($('.js-timeago'), $("##{dom_id(@project_member)}"));
:plain
var $listItem = $('#{escape_javascript(render('shared/members/member', member: @member))}');
$("##{dom_id(@member)} .list-item-name").replaceWith($listItem.find('.list-item-name'));
gl.utils.localTimeAgo($('.js-timeago'), $("##{dom_id(@member)}"));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment