From 2aa3070b95c3fc59178b4b66a123b82b49465b63 Mon Sep 17 00:00:00 2001 From: Bilka Date: Tue, 27 Jan 2026 21:02:10 +0100 Subject: [PATCH] AO3-5963 Fix that invitation requests would get stuck if invitation had invalid email --- app/models/invite_request.rb | 5 ++--- features/other_a/invite_queue.feature | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/models/invite_request.rb b/app/models/invite_request.rb index d17857cc2fe..e78702db65e 100644 --- a/app/models/invite_request.rb +++ b/app/models/invite_request.rb @@ -53,8 +53,7 @@ def compare_with_users def invite_and_remove(creator=nil) invitation = creator ? creator.invitations.build(invitee_email: self.email, from_queue: true) : Invitation.new(invitee_email: self.email, from_queue: true) - if invitation.save - self.destroy - end + invitation.save + self.destroy end end diff --git a/features/other_a/invite_queue.feature b/features/other_a/invite_queue.feature index dea9800bd88..fc58e39e01f 100644 --- a/features/other_a/invite_queue.feature +++ b/features/other_a/invite_queue.feature @@ -181,3 +181,20 @@ Feature: Invite queue management When I press "Resend Invitation" Then 1 email should be delivered to invitee@example.org + + Scenario: Invitation requests don't get stuck in the queue if a user changes their email to the requests' email + Given account creation is enabled + And the invitation queue is enabled + And account creation requires an invitation + And the invite_from_queue_at is yesterday + And an invitation request for "test@archiveofourown.org" + And the following activated users exist + | login | email | + | fred | nottest@archiveofourown.org | + When I am logged in as "fred" + And I change my email to "test@archiveofourown.org" + And all emails have been delivered + And the scheduled check_invite_queue job is run + And I go to the invite_requests page + Then I should see "There are currently 0 people on the waiting list" + And 0 emails should be delivered to test@archiveofourown.org