mirror of
https://github.com/discourse/discourse.git
synced 2026-08-09 04:28:29 -05:00
FIX: Moderator notifications when new post auto-silences a user (#35403)
When a user is auto-silenced because they receive enough spam flag, we notify moderators (given the notify_mods_when_user_silenced is enabled). However, when a user is auto-silenced for other reasons, e.g. typing too fast, we don't send this notification. This commit: - Lifts the notification logic into a new UserSilencer#auto_silence method, which delegates 99% of its work to UserSilencer#silence. - Uses this new method in places where users are auto-silenced.
This commit is contained in:
@@ -178,21 +178,21 @@ class NewPostManager
|
||||
|
||||
I18n.with_locale(SiteSetting.default_locale) do
|
||||
if is_fast_typer?(manager)
|
||||
UserSilencer.silence(
|
||||
UserSilencer.auto_silence(
|
||||
manager.user,
|
||||
Discourse.system_user,
|
||||
keep_posts: true,
|
||||
reason: I18n.t("user.new_user_typed_too_fast"),
|
||||
)
|
||||
elsif auto_silence?(manager) || matches_auto_silence_regex?(manager)
|
||||
UserSilencer.silence(
|
||||
UserSilencer.auto_silence(
|
||||
manager.user,
|
||||
Discourse.system_user,
|
||||
keep_posts: true,
|
||||
reason: I18n.t("user.content_matches_auto_silence_regex"),
|
||||
)
|
||||
elsif reason == :email_spam && is_first_post?(manager)
|
||||
UserSilencer.silence(
|
||||
UserSilencer.auto_silence(
|
||||
manager.user,
|
||||
Discourse.system_user,
|
||||
keep_posts: true,
|
||||
|
||||
Reference in New Issue
Block a user