mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: dont allow channel non-members to write messages in threads (#31697)
Prevents channel non-members from seeing the composer in threads. Since they do not have the correct permissions to post within the channel, we should show the join channel CTA in place of the chat composer.
This commit is contained in:
@ -8,19 +8,17 @@ RSpec.describe "Message errors", type: :system do
|
||||
let(:message) { "atoolongmessage" + "a" * max_length }
|
||||
|
||||
fab!(:current_user) { Fabricate(:admin) }
|
||||
fab!(:channel) { Fabricate(:chat_channel, threading_enabled: true) }
|
||||
|
||||
before do
|
||||
chat_system_bootstrap
|
||||
sign_in(current_user)
|
||||
channel.add(current_user)
|
||||
end
|
||||
|
||||
context "when in channel" do
|
||||
fab!(:channel) { Fabricate(:chat_channel) }
|
||||
|
||||
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
||||
|
||||
before { channel.add(current_user) }
|
||||
|
||||
it "shows a dialog with the error and keeps the message in the input" do
|
||||
chat_page.visit_channel(channel)
|
||||
|
||||
@ -34,7 +32,7 @@ RSpec.describe "Message errors", type: :system do
|
||||
end
|
||||
|
||||
context "when in thread" do
|
||||
fab!(:thread) { Fabricate(:chat_thread) }
|
||||
fab!(:thread) { Fabricate(:chat_thread, channel: channel) }
|
||||
|
||||
let(:thread_page) { PageObjects::Pages::ChatThread.new }
|
||||
|
||||
|
Reference in New Issue
Block a user