mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: Convert email_in_min_trust to groups (#24515)
This change converts the `email_in_min_trust` site setting to `email_in_allowed_groups`. See: https://meta.discourse.org/t/283408 - Hides the old setting - Adds the new site setting - Add a deprecation warning - Updates to use the new setting - Adds a migration to fill in the new setting if the old setting was changed - Adds an entry to the site_setting.keywords section - Updates tests to account for the new change After a couple of months we will remove the `email_in_min_trust` setting entirely. Internal ref: /t/115696
This commit is contained in:
@ -859,7 +859,8 @@ module Email
|
||||
|
||||
user ||= stage_from_user
|
||||
|
||||
if !user.has_trust_level?(SiteSetting.email_in_min_trust) && !sent_to_mailinglist_mirror?
|
||||
if user.groups.any? && !user.in_any_groups?(SiteSetting.email_in_allowed_groups_map) &&
|
||||
!sent_to_mailinglist_mirror?
|
||||
raise InsufficientTrustLevelError
|
||||
end
|
||||
|
||||
@ -1067,7 +1068,9 @@ module Email
|
||||
)
|
||||
elsif destination.is_a?(Category)
|
||||
return false if user.staged? && !destination.email_in_allow_strangers
|
||||
return false if !user.has_trust_level?(SiteSetting.email_in_min_trust)
|
||||
if user.groups.any? && !user.in_any_groups?(SiteSetting.email_in_allowed_groups_map)
|
||||
return false
|
||||
end
|
||||
|
||||
topic_user = embedded_user&.call || user
|
||||
create_topic(
|
||||
|
Reference in New Issue
Block a user