mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 16:51:25 +08:00
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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user