Show preview when user has read-only access

This commit is contained in:
Jan Cernik 2023-02-08 12:51:19 -03:00
parent 5f353cb63e
commit 9c148fa152
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -251,7 +251,7 @@ module Chat::ChatChannelFetcher
end
raise Discourse::NotFound if chat_channel.blank?
raise Discourse::InvalidAccess if !guardian.can_join_chat_channel?(chat_channel)
raise Discourse::InvalidAccess if !guardian.can_preview_chat_channel?(chat_channel)
chat_channel
end
end

View File

@ -1312,7 +1312,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_join_chat_channel?).with(channel)
Guardian.any_instance.expects(:can_preview_chat_channel?).with(channel)
sign_in(Fabricate(:user))
get "/chat/message/#{message.id}.json"
@ -1328,7 +1328,7 @@ RSpec.describe Chat::ChatController do
before { sign_in(user) }
it "ensures message's channel can be seen" do
Guardian.any_instance.expects(:can_join_chat_channel?).with(channel)
Guardian.any_instance.expects(:can_preview_chat_channel?).with(channel)
get "/chat/lookup/#{message.id}.json", params: { chat_channel_id: channel.id }
end