FIX: Do not preview chat channels to read-only users (#21700)

We want to simplify this case as it contains a lot of rabbit holes.
This commit is contained in:
Jan Cernik
2023-05-24 09:05:20 -03:00
committed by GitHub
parent 4332f4b833
commit 436b68a581
5 changed files with 7 additions and 43 deletions

View File

@ -1125,7 +1125,7 @@ RSpec.describe Chat::ChatController do
channel = Fabricate(:category_channel, chatable: Fabricate(:category))
message = Fabricate(:chat_message, chat_channel: channel)
Guardian.any_instance.expects(:can_preview_chat_channel?).with(channel)
Guardian.any_instance.expects(:can_join_chat_channel?).with(channel)
sign_in(Fabricate(:user))
get "/chat/message/#{message.id}.json"
@ -1141,7 +1141,7 @@ RSpec.describe Chat::ChatController do
before { sign_in(user) }
it "ensures message's channel can be seen" do
Guardian.any_instance.expects(:can_preview_chat_channel?).with(channel)
Guardian.any_instance.expects(:can_join_chat_channel?).with(channel)
get "/chat/lookup/#{message.id}.json", params: { chat_channel_id: channel.id }
end