DEV: Use staged user check instead (#24578)

This change refactors the check `user.groups.any?` and instead uses
`user.staged?` to check if the user is staged or not.

Also fixes several tests to ensure the users have their auto trust level
groups created.

Follow up to:

- 8a45f84277e6e13bc48b8f4e40350a9cbd5cd2ee
- 447d9b210556e64c14f9ca9f8f9b52f54090cd41
- c89edd9e86870f97a770816210d71400f09181f2
This commit is contained in:
Blake Erickson
2023-11-28 07:34:02 -07:00
committed by GitHub
parent 2a3418fe24
commit 21d614215b
4 changed files with 18 additions and 13 deletions

View File

@ -859,7 +859,7 @@ module Email
user ||= stage_from_user
if user.groups.any? && !user.in_any_groups?(SiteSetting.email_in_allowed_groups_map) &&
if !user.staged? && !user.in_any_groups?(SiteSetting.email_in_allowed_groups_map) &&
!sent_to_mailinglist_mirror?
raise InsufficientTrustLevelError
end