FEATURE: new 'auto_respond_to_flag_actions' site setting
This commit is contained in:
parent
c8631a7a8b
commit
afd2417945
|
@ -183,6 +183,7 @@ class PostAction < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def add_moderator_post_if_needed(moderator, disposition, delete_post=false)
|
||||
return if !SiteSetting.auto_respond_to_flag_actions
|
||||
return if related_post.nil? || related_post.topic.nil?
|
||||
return if moderator_already_replied?(related_post.topic, moderator)
|
||||
message_key = "flags_dispositions.#{disposition}"
|
||||
|
|
|
@ -1036,6 +1036,8 @@ en:
|
|||
num_flaggers_to_close_topic: "Minimum number of unique flaggers that is required to automatically pause a topic for intervention"
|
||||
num_flags_to_close_topic: "Minimum number of active flags that is required to automatically pause a topic for intervention"
|
||||
|
||||
auto_respond_to_flag_actions: "Enable automatic reply when disposing a flag."
|
||||
|
||||
reply_by_email_enabled: "Enable replying to topics via email."
|
||||
reply_by_email_address: "Template for reply by email incoming email address, for example: %{reply_key}@reply.example.com or replies+%{reply_key}@example.com"
|
||||
|
||||
|
|
|
@ -622,6 +622,7 @@ spam:
|
|||
max_age_unmatched_ips: 365
|
||||
num_flaggers_to_close_topic: 5
|
||||
num_flags_to_close_topic: 12
|
||||
auto_respond_to_flag_actions: true
|
||||
|
||||
rate_limits:
|
||||
unique_posts_mins:
|
||||
|
|
|
@ -460,9 +460,23 @@ describe PostAction do
|
|||
|
||||
describe ".add_moderator_post_if_needed" do
|
||||
|
||||
it "should not generate a notification for auto-message" do
|
||||
it "should not add a moderator post when it's disabled" do
|
||||
post = create_post
|
||||
|
||||
action = PostAction.act(moderator, post, PostActionType.types[:spam], message: "WAT")
|
||||
action.reload
|
||||
topic = action.related_post.topic
|
||||
expect(topic.posts.count).to eq(1)
|
||||
|
||||
SiteSetting.expects(:auto_respond_to_flag_actions).returns(false)
|
||||
PostAction.agree_flags!(post, admin)
|
||||
|
||||
topic.reload
|
||||
expect(topic.posts.count).to eq(1)
|
||||
end
|
||||
|
||||
it "should not generate a notification for auto-message" do
|
||||
post = create_post
|
||||
PostAction.act(moderator, post, PostActionType.types[:spam], message: "WAT")
|
||||
|
||||
PostAlerter.expects(:post_created).never
|
||||
|
|
Loading…
Reference in New Issue