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:
David Battersby
2025-03-07 15:50:30 +04:00
committed by GitHub
parent 5bab18e3ea
commit 914543dbb9
4 changed files with 43 additions and 13 deletions

View File

@ -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 }