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

Don't send the "access declined" email on access request withdrawal

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 724f986f
......@@ -10,7 +10,9 @@ module Members
if can?(current_user, "destroy_#{member.type.underscore}".to_sym, member)
member.destroy
notification_service.decline_access_request(member) if member.request?
if member.request? && member.user != current_user
notification_service.decline_access_request(member)
end
end
member
......
......@@ -34,6 +34,14 @@ describe Members::DestroyService, services: true do
destroy_member(member, user)
end
context 'when current user is the member' do
it 'does not call Member#after_decline_request' do
expect_any_instance_of(NotificationService).not_to receive(:decline_access_request).with(member)
destroy_member(member, member.user)
end
end
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