Skip to content

A platform for community discussion. Free, open, simple.

FIX: prevents admins to be silenced (#21854)

Joffrey JAFFEUX9ba333808f11
diff --git a/plugins/chat/lib/chat/review_queue.rb b/plugins/chat/lib/chat/review_queue.rb
index 6b886dac4bd..e90d46f9fb5 100644
--- a/plugins/chat/lib/chat/review_queue.rb
+++ b/plugins/chat/lib/chat/review_queue.rb
@@ -87,6 +87,7 @@ module Chat
return if reviewable.score <= Chat::ReviewableMessage.score_to_silence_user
user = reviewable.target_created_by
+ return if user.admin?
return unless user
return if user.silenced?
diff --git a/plugins/chat/spec/lib/chat/review_queue_spec.rb b/plugins/chat/spec/lib/chat/review_queue_spec.rb
index beed58049cf..fb147e7df2e 100644
--- a/plugins/chat/spec/lib/chat/review_queue_spec.rb
+++ b/plugins/chat/spec/lib/chat/review_queue_spec.rb
@@ -369,6 +369,18 @@ describe Chat::ReviewQueue do
expect(message_poster.reload.silenced?).to eq(false)
end
+
+ context "when the target is an admin" do
+ it "does not silence the user" do
+ SiteSetting.chat_auto_silence_from_flags_duration = 1
+ flagger.update!(trust_level: TrustLevel[4]) # Increase Score due to TL Bonus.
+ message_poster.update!(admin: true)
+
+ queue.flag_message(message, guardian, ReviewableScore.types[:off_topic])
+
+ expect(message_poster.reload.silenced?).to eq(false)
+ end
+ end
end
context "when flagging a DM" do