A platform for community discussion. Free, open, simple.
FEATURE: Do not autoclose topics due to user flagging that are authored by staff
Jeff Wong3359b3baca19
diff --git a/app/models/post_action.rb b/app/models/post_action.rbindex 055c5d14898..f0d7f07e66b 100644--- a/app/models/post_action.rb+++ b/app/models/post_action.rb@@ -565,6 +565,7 @@ class PostAction < ActiveRecord::BaseMAXIMUM_FLAGS_PER_POST = 3def self.auto_close_threshold_reached?(topic)+ return if topic.user&.staff?flags = PostAction.active.flags.joins(:post)diff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rbindex d17b6647155..95f531719c9 100644--- a/spec/models/post_action_spec.rb+++ b/spec/models/post_action_spec.rb@@ -920,6 +920,21 @@ describe PostAction doexpect(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" dofreeze_time