BigW Consortium Gitlab

Commit 724f986f by Rémy Coutable

Redirect to the member's source on request withdrawal

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent 6c5b2377
...@@ -34,8 +34,9 @@ module MembershipActions ...@@ -34,8 +34,9 @@ module MembershipActions
else else
"You left the \"#{@member.source.human_name}\" #{source_type}." "You left the \"#{@member.source.human_name}\" #{source_type}."
end end
redirect_path = @member.request? ? @member.source : [:dashboard, @member.real_source_type.tableize]
redirect_to [:dashboard, @member.real_source_type.tableize], notice: notice redirect_to redirect_path, notice: notice
else else
if cannot_leave? if cannot_leave?
alert = "You can not leave the \"#{@member.source.human_name}\" #{source_type}." alert = "You can not leave the \"#{@member.source.human_name}\" #{source_type}."
......
...@@ -134,7 +134,7 @@ describe Groups::GroupMembersController do ...@@ -134,7 +134,7 @@ describe Groups::GroupMembersController do
delete :leave, group_id: group delete :leave, group_id: group
expect(response).to set_flash.to 'Your access request to the group has been withdrawn.' expect(response).to set_flash.to 'Your access request to the group has been withdrawn.'
expect(response).to redirect_to(dashboard_groups_path) expect(response).to redirect_to(group_path(group))
expect(group.members.request).to be_empty expect(group.members.request).to be_empty
expect(group.users).not_to include user expect(group.users).not_to include user
end end
......
...@@ -190,7 +190,7 @@ describe Projects::ProjectMembersController do ...@@ -190,7 +190,7 @@ describe Projects::ProjectMembersController do
project_id: project project_id: project
expect(response).to set_flash.to 'Your access request to the project has been withdrawn.' expect(response).to set_flash.to 'Your access request to the project has been withdrawn.'
expect(response).to redirect_to(dashboard_projects_path) expect(response).to redirect_to(namespace_project_path(project.namespace, project))
expect(project.members.request).to be_empty expect(project.members.request).to be_empty
expect(project.users).not_to include user expect(project.users).not_to include user
end end
......
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