mirror of
https://github.com/discourse/discourse.git
synced 2025-03-23 14:15:46 +08:00
FEATURE: Do not autoclose topics due to user flagging that are authored by staff
This commit is contained in:
parent
fe6d571021
commit
3359b3baca
@ -565,6 +565,7 @@ class PostAction < ActiveRecord::Base
|
||||
MAXIMUM_FLAGS_PER_POST = 3
|
||||
|
||||
def self.auto_close_threshold_reached?(topic)
|
||||
return if topic.user&.staff?
|
||||
flags = PostAction.active
|
||||
.flags
|
||||
.joins(:post)
|
||||
|
@ -920,6 +920,21 @@ describe PostAction do
|
||||
expect(topic_status_update.status_type).to eq(TopicTimer.types[:open])
|
||||
end
|
||||
|
||||
context "on a staff post" do
|
||||
let(:staff_user) { Fabricate(:user, moderator: true) }
|
||||
let(:topic) { Fabricate(:topic, user: staff_user) }
|
||||
|
||||
it "will not close topics opened by staff" do
|
||||
[flagger1, flagger2].each do |flagger|
|
||||
[post1, post2, post3].each do |post|
|
||||
PostAction.act(flagger, post, PostActionType.types[:inappropriate])
|
||||
end
|
||||
end
|
||||
|
||||
expect(topic.reload.closed).to eq(false)
|
||||
end
|
||||
end
|
||||
|
||||
it "will keep the topic in closed status until the community flags are handled" do
|
||||
freeze_time
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user