mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 02:11:08 -06:00
FIX: do not add a moderator post when post is flagged via direct message (#6100)
This commit is contained in:
parent
c1249d9e1d
commit
a9ebad3f6c
@ -152,7 +152,7 @@ class PostAction < ActiveRecord::Base
|
||||
def self.agree_flags!(post, moderator, delete_post = false)
|
||||
actions = PostAction.active
|
||||
.where(post_id: post.id)
|
||||
.where(post_action_type_id: PostActionType.flag_types.values)
|
||||
.where(post_action_type_id: PostActionType.notify_flag_types.values)
|
||||
|
||||
trigger_spam = false
|
||||
actions.each do |action|
|
||||
|
@ -672,6 +672,20 @@ describe PostAction do
|
||||
expect(user_notifications.last.topic).to eq(topic)
|
||||
end
|
||||
|
||||
it "should not add a moderator post when post is flagged via private message" do
|
||||
SiteSetting.queue_jobs = false
|
||||
post = Fabricate(:post)
|
||||
user = Fabricate(:user)
|
||||
action = PostAction.act(user, post, PostActionType.types[:notify_user], message: "WAT")
|
||||
topic = action.reload.related_post.topic
|
||||
expect(user.notifications.count).to eq(0)
|
||||
|
||||
SiteSetting.auto_respond_to_flag_actions = true
|
||||
PostAction.agree_flags!(post, admin)
|
||||
|
||||
user_notifications = user.notifications
|
||||
expect(user_notifications.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
describe "rate limiting" do
|
||||
|
Loading…
Reference in New Issue
Block a user