mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +08:00
FIX: prevents admins to be silenced (#21854)
Currently in chat it was possible to have TL4 users to flag admins and silence them, this change should ensure it's never possible.
This commit is contained in:
parent
96a2893284
commit
9ba333808f
|
@ -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?
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user