Bulk User Invite with Error

I just tested this on my own site with a staged user’s email address in the bulk invite CSV file. The response I got from Discourse was:

Your bulk user invite file was processed, 1 invites mailed.

but there was no invite sent. I’m not sure what the expected behaviour is for inviting staged users, but the problem in the Discourse code seems to happen here: discourse/app/jobs/regular/bulk_invite.rb at main · discourse/discourse · GitHub. User.find_by_email(<staged_user_email>) will return a user, so the invite doesn’t get sent.

If staged users cannot be invited to the forum, the notification that is sent should not say that invites were mailed for these users.

Edit: not being able to bulk invite staged users seems to be a regression. Sending individual invites to staged users works without any problems.