FEATURE: log reason staff auto blocks a user
This commit is contained in:
parent
f13367cecd
commit
16593ae8bf
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue