fefrei reported an issue where inactive users in a staged Discourse installation for a yearly event were rejected when sending emails, receiving an Email::Receiver::InactiveUserError. zogstrip explained that this error occurs when a user is neither activated nor staged, suggesting that marking users as staged would resolve the issue. When fefrei asked if existing inactive users could be marked as staged via the admin UI, zogstrip clarified that this requires using the Rails console or a SQL query, confirming that users would revert to normal status upon logging in. fefrei later noted a bug where users who logged in via SSO remained staged even after becoming active. zogstrip acknowledged the potential SSO-related issue and investigated. Meanwhile, fefrei shared a Rails console command to update inactive users: User.where({ active: false }).update_all({ staged: true }). zogstrip suggested a more concise syntax. Finally, zogstrip pushed a fix for the SSO staging issue, which fefrei confirmed was successful after deployment.
When such a user sends a mail to Discourse, they are rejected with Email::Receiver::InactiveUserError.
What’s the best method to prevent this issue? Would replacing the mail address of the inactive accounts work?
The InactiveUserError happens only when the user is not activated and not staged. If you want your users to be able to send emails in, you will have to either activate their account or mark them as staged.
I had a non-active, staged user (that had been disabled via the interface and staged via Rails). After the user logged in (via SSO), he had to confirm has address, became active and could log in, but is still staged: