Resolve "Destroying a project causes post_decline_request to be executed"
What does this MR do?
Ensure we don't send "access request declined" to access requesters when a project is deleted.
Are there points in the code the reviewer needs to double check?
I've created a service to decouple the notification sending from the AR model.
Why was this MR needed?
Because there was an issue.
What are the relevant issue numbers?
Fixes #18755 (closed), #18750 (closed).
Does this MR meet the acceptance criteria?
-
No CHANGELOG needed. -
Tests -
Added for this feature/bug -
All builds are passing
-
-
Conform by the style guides -
Branch has no merge conflicts with master
(if you do - rebase it please) -
Squashed related commits together
Merge request reports
Activity
mentioned in issue #18750 (closed)
Added 4 commits:
- a79b7c14 - New Members::DestroyService
- 55cc4b13 - Use the new Members::DestroyService in group/project member controllers
- b8784155 - Redirect to the member's source on request withdrawal
- a1e1296f - Don't send the "access declined" email on access request withdrawal
Toggle commit listReassigned to @DouweM
Reassigned to @rymai
Reassigned to @DouweM
@rymai Do we still have special error message behavior for the
cannot_delete?
case of being last owner? I think we should.AccessDenied
and error 403 only makes sense if the user tries to do something they're not allowed to.Edited by Douwe MaanReassigned to @rymai
Added 473 commits:
- ec7d2328...00906b5b - 466 commits from branch
master
- 4652489f - New Members::DestroyService
- 6c5b2377 - Use the new Members::DestroyService in group/project member controllers
- 724f986f - Redirect to the member's source on request withdrawal
- a08a26ac - Don't send the "access declined" email on access request withdrawal
- 654565c9 - Raise a new Gitlab::Access::AccessDeniedError when permission is not enough to destroy a member
- bceee987 - Show 'Leave project' only if member can actually leave the project
- bf05ca88 - Add 'Leave Group' link
Toggle commit list- ec7d2328...00906b5b - 466 commits from branch
3 3 = link_to namespace_project_project_members_path(@project.namespace, @project), title: 'Members', class: 'team-tab tab' do 4 4 %span 5 5 Members 6 if access && can_edit 6 if can_edit 3 - member = @group.members.non_request.find_by(user_id: current_user.id) 4 - can_leave = member && can?(current_user, :destroy_group_member, member) 5 6 .controls 7 .dropdown.group-settings-dropdown 8 %a.dropdown-new.btn.btn-default#group-settings-button{href: '#', 'data-toggle' => 'dropdown'} 9 = icon('cog') 10 = icon('caret-down') 11 %ul.dropdown-menu.dropdown-menu-align-right 12 = nav_link(path: 'groups#projects') do 13 = link_to 'Projects', projects_group_path(@group), title: 'Projects' 14 %li.divider 15 - if can_edit 16 %li 17 = link_to 'Edit Group', edit_group_path(@group) 18 - if can_leave @DouweM I re-added the "Leave Group" link (I think I removed it inadvertently in the request access MR), and displays it only when the current user can actually leave the group (same for project in
app/views/layouts/nav/_project.html.haml
).I think this makes more sense than displaying the link and then showing a "You can not leave this project" alert once it's clicked... Also, we're already using this logic in the members list page.
error 403 only makes sense if the user tries to do something they're not allowed to.
Now, this is the case!
Added 1 commit:
- 909a0ff3 - Fix and remove duplicate specs
Reassigned to @DouweM
mentioned in commit c11006ac
mentioned in issue #18970 (closed)
Aha, I'm glad you like it @vsizov! ;)
mentioned in issue #18790 (closed)
mentioned in commit 9af7d71b
Mentioned in commit jmcgeheeiv/gitlab-ce@c11006ac
Mentioned in commit xhang/gitlab-ce@9af7d71b