diff --git a/app/services/user_blocker.rb b/app/services/user_blocker.rb index 01b5896e887..fe0091425e9 100644 --- a/app/services/user_blocker.rb +++ b/app/services/user_blocker.rb @@ -20,7 +20,7 @@ class UserBlocker message_type = @opts[:message] || :blocked_by_staff post = SystemMessage.create(@user, message_type) if post && @by_user - StaffActionLogger.new(@by_user).log_block_user(@user, {context: "#{message_type}: '#{post.topic&.title rescue ''}'"}) + StaffActionLogger.new(@by_user).log_block_user(@user, {context: "#{message_type}: '#{post.topic&.title rescue ''}' #{@opts[:reason]}"}) end end else diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index f68d72b22e4..f3042f594b6 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1640,6 +1640,8 @@ en: deactivated: "Was deactivated due to too many bounced emails to '%{email}'." deactivated_by_staff: "Deactivated by staff" activated_by_staff: "Activated by staff" + new_user_typed_too_fast: "New user typed too fast" + content_matches_auto_block_regex: "Content matches auto block regex" username: short: "must be at least %{min} characters" long: "must be no more than %{max} characters" diff --git a/lib/new_post_manager.rb b/lib/new_post_manager.rb index 27aebae6639..537c7faff04 100644 --- a/lib/new_post_manager.rb +++ b/lib/new_post_manager.rb @@ -104,8 +104,10 @@ class NewPostManager result = manager.enqueue('default') - if is_fast_typer?(manager) || matches_auto_block_regex?(manager) - UserBlocker.block(manager.user, Discourse.system_user, keep_posts: true) + if is_fast_typer?(manager) + UserBlocker.block(manager.user, Discourse.system_user, keep_posts: true, reason: I18n.t("user.new_user_typed_too_fast")) + elsif matches_auto_block_regex?(manager) + UserBlocker.block(manager.user, Discourse.system_user, keep_posts: true, reason: I18n.t("user.content_matches_auto_block_regex")) end result