mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add notify_mods_when_user_blocked site setting to control whether moderators get a message when someone is automatically blocked
This commit is contained in:
parent
8431a5c1f5
commit
7eaedb84e1
@ -67,6 +67,7 @@ class SiteSetting < ActiveRecord::Base
|
|||||||
|
|
||||||
setting(:num_flags_to_block_new_user, 3)
|
setting(:num_flags_to_block_new_user, 3)
|
||||||
setting(:num_users_to_block_new_user, 3)
|
setting(:num_users_to_block_new_user, 3)
|
||||||
|
setting(:notify_mods_when_user_blocked, true)
|
||||||
|
|
||||||
# used mainly for dev, force hostname for Discourse.base_url
|
# used mainly for dev, force hostname for Discourse.base_url
|
||||||
# You would usually use multisite for this
|
# You would usually use multisite for this
|
||||||
|
@ -48,7 +48,7 @@ class SpamRulesEnforcer
|
|||||||
|
|
||||||
def punish_user
|
def punish_user
|
||||||
Post.transaction do
|
Post.transaction do
|
||||||
if UserBlocker.block(@user, nil, {message: :too_many_spam_flags})
|
if UserBlocker.block(@user, nil, {message: :too_many_spam_flags}) and SiteSetting.notify_mods_when_user_blocked
|
||||||
GroupMessage.create(Group[:moderators].name, :user_automatically_blocked, {user: @user, limit_once_per: false})
|
GroupMessage.create(Group[:moderators].name, :user_automatically_blocked, {user: @user, limit_once_per: false})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -505,7 +505,7 @@ en:
|
|||||||
cooldown_minutes_after_hiding_posts: "Number of minutes a user must wait before they can edit a post hidden via flagging"
|
cooldown_minutes_after_hiding_posts: "Number of minutes a user must wait before they can edit a post hidden via flagging"
|
||||||
num_flags_to_block_new_user: "If a new user's posts get this many spam flags from (n) different users, hide all their posts and prevent future posting. 0 disables this feature."
|
num_flags_to_block_new_user: "If a new user's posts get this many spam flags from (n) different users, hide all their posts and prevent future posting. 0 disables this feature."
|
||||||
num_users_to_block_new_user: "If a new user's posts get (x) spam flags from this many different users, hide all their posts and prevent future posting. 0 disables this feature."
|
num_users_to_block_new_user: "If a new user's posts get (x) spam flags from this many different users, hide all their posts and prevent future posting. 0 disables this feature."
|
||||||
|
notify_mods_when_user_blocked: "If a user is automatically blocked, send a message to all moderators."
|
||||||
|
|
||||||
traditional_markdown_linebreaks: "Use traditional linebreaks in Markdown, which require two trailing spaces for a linebreak"
|
traditional_markdown_linebreaks: "Use traditional linebreaks in Markdown, which require two trailing spaces for a linebreak"
|
||||||
post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)"
|
post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)"
|
||||||
|
@ -128,6 +128,12 @@ describe SpamRulesEnforcer do
|
|||||||
end
|
end
|
||||||
subject.punish_user
|
subject.punish_user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't send a pm to moderators if notify_mods_when_user_blocked is false" do
|
||||||
|
SiteSetting.stubs(:notify_mods_when_user_blocked).returns(false)
|
||||||
|
GroupMessage.expects(:create).never
|
||||||
|
subject.punish_user
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'user is already blocked' do
|
context 'user is already blocked' do
|
||||||
|
Loading…
Reference in New Issue
Block a user