diff options
-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 | ||||
-rw-r--r-- | app/views/groups/group_members/update.js.haml | 4 | ||||
-rw-r--r-- | app/views/projects/project_members/update.js.haml | 4 | ||||
-rw-r--r-- | app/views/shared/members/update.js.haml | 4 | ||||
-rw-r--r-- | spec/features/groups/members/manage_members_spec.rb (renamed from spec/features/groups/members/manage_members.rb) | 0 |
7 files changed, 16 insertions, 24 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) diff --git a/app/views/groups/group_members/update.js.haml b/app/views/groups/group_members/update.js.haml deleted file mode 100644 index 9d05bff6c4e..00000000000 --- a/app/views/groups/group_members/update.js.haml +++ /dev/null @@ -1,4 +0,0 @@ -: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)}")); diff --git a/app/views/projects/project_members/update.js.haml b/app/views/projects/project_members/update.js.haml deleted file mode 100644 index d15f4310ff5..00000000000 --- a/app/views/projects/project_members/update.js.haml +++ /dev/null @@ -1,4 +0,0 @@ -: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)}")); diff --git a/app/views/shared/members/update.js.haml b/app/views/shared/members/update.js.haml new file mode 100644 index 00000000000..597d984d0eb --- /dev/null +++ b/app/views/shared/members/update.js.haml @@ -0,0 +1,4 @@ +: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)}")); diff --git a/spec/features/groups/members/manage_members.rb b/spec/features/groups/members/manage_members_spec.rb index 21f7b4999ad..21f7b4999ad 100644 --- a/spec/features/groups/members/manage_members.rb +++ b/spec/features/groups/members/manage_members_spec.rb |