Show preview when user has read-only access
This commit is contained in:
parent
5f353cb63e
commit
9c148fa152
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user