mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 17:53:55 +08:00
Providing a more attractive empty state and join CTA for chat channels. | Scenario | Desktop | Drawer | Mobile | |--------|--------|--------|--------| | Anon | <img width="1746" height="1606" alt="CleanShot 2026-07-17 at 12 05 42@2x" src="https://github.com/user-attachments/assets/080d0785-fc5b-46ca-9cd7-1631ad8f0319" /> | <img width="1748" height="1628" alt="CleanShot 2026-07-17 at 12 07 32@2x" src="https://github.com/user-attachments/assets/d0ad65f1-ac7c-4365-88d9-88e30896f0b0" /> | <img width="736" height="1580" alt="CleanShot 2026-07-17 at 12 07 17@2x" src="https://github.com/user-attachments/assets/ae37e80c-db8e-49cd-8a24-79e5a05cb034" /> | | Logged in, unjoined | <img width="1782" height="1622" alt="CleanShot 2026-07-17 at 12 09 09@2x" src="https://github.com/user-attachments/assets/f0adbe95-449b-43b7-92b2-3095a4ae9918" /> | <img width="1748" height="1628" alt="CleanShot 2026-07-17 at 12 08 01@2x" src="https://github.com/user-attachments/assets/a081a53b-5e14-403d-8eca-027b4b221add" /> | <img width="732" height="1582" alt="CleanShot 2026-07-17 at 12 09 19@2x" src="https://github.com/user-attachments/assets/f7f2348c-e84c-4386-806a-4a68437bc988" /> | | Logged in, joined | <img width="1782" height="1622" alt="CleanShot 2026-07-17 at 12 08 48@2x" src="https://github.com/user-attachments/assets/59389f72-06e0-49a0-a50f-dd6f8fd3cd0a" /> | <img width="1748" height="1628" alt="CleanShot 2026-07-17 at 12 08 24@2x" src="https://github.com/user-attachments/assets/67ebdbae-3252-4472-ba0d-db8af59f02f2" /> | <img width="732" height="1582" alt="CleanShot 2026-07-17 at 12 09 30@2x" src="https://github.com/user-attachments/assets/8d5b893f-7fee-4368-982f-9d53bef400f4" /> |
90 lines
2.8 KiB
Ruby
Vendored
90 lines
2.8 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
RSpec.describe "Anonymous public chat channels" do
|
|
fab!(:public_channel) { Fabricate(:category_channel, name: "general") }
|
|
fab!(:private_channel, :private_category_channel)
|
|
fab!(:existing_message) do
|
|
Fabricate(
|
|
:chat_message,
|
|
chat_channel: public_channel,
|
|
message: "Existing public channel update",
|
|
)
|
|
end
|
|
|
|
let(:chat_page) { PageObjects::Pages::Chat.new }
|
|
let(:channel_page) { PageObjects::Pages::ChatChannel.new }
|
|
let(:thread_page) { PageObjects::Pages::ChatThread.new }
|
|
let(:chat_drawer_page) { PageObjects::Pages::ChatDrawer.new }
|
|
let(:chat_sidebar_page) { PageObjects::Pages::ChatSidebar.new }
|
|
let(:login_page) { PageObjects::Pages::Login.new }
|
|
|
|
before do
|
|
chat_system_bootstrap
|
|
SiteSetting.chat_allowed_groups =
|
|
"#{Group::AUTO_GROUPS[:everyone]}|#{Group::AUTO_GROUPS[:anonymous_users]}"
|
|
end
|
|
|
|
it "lets visitors read public channel activity without write or browse controls" do
|
|
chat_page.visit_channels
|
|
|
|
expect(chat_page).to have_public_channel(public_channel)
|
|
expect(chat_page).to have_no_public_channel(private_channel)
|
|
expect(chat_page).to have_no_browse_page_button
|
|
|
|
chat_page.open_public_channel(public_channel)
|
|
|
|
expect(channel_page.messages).to have_message(
|
|
id: existing_message.id,
|
|
text: "Existing public channel update",
|
|
)
|
|
expect(channel_page).to have_anonymous_preview_card
|
|
expect(channel_page).to have_no_composer
|
|
expect(channel_page).to have_no_search_button
|
|
expect(channel_page).to have_no_star_button
|
|
|
|
channel_page.click_preview_card_login
|
|
|
|
expect(login_page).to be_open
|
|
end
|
|
|
|
it "lets visitors open public chat channels from the sidebar drawer" do
|
|
SiteSetting.navigation_menu = "sidebar"
|
|
|
|
visit("/")
|
|
chat_page.prefers_drawer
|
|
|
|
expect(chat_sidebar_page).to have_channel(public_channel)
|
|
expect(chat_sidebar_page).to have_no_channel(private_channel)
|
|
|
|
chat_sidebar_page.open_channel(public_channel)
|
|
|
|
expect(chat_drawer_page).to have_open_channel(public_channel)
|
|
|
|
chat_drawer_page.click_preview_card_login
|
|
expect(login_page).to be_open
|
|
end
|
|
|
|
it "keeps visitors out of browse" do
|
|
visit("/chat/browse/open")
|
|
|
|
expect(page).to have_current_path("/chat/channels")
|
|
end
|
|
|
|
it "renders threaded public channels for visitors" do
|
|
public_channel.update!(threading_enabled: true)
|
|
|
|
chat_page.visit_channels
|
|
|
|
expect(chat_page).to have_public_channel(public_channel)
|
|
end
|
|
|
|
it "lets visitors jump from a public thread to its original message" do
|
|
public_channel.update!(threading_enabled: true)
|
|
thread = Fabricate(:chat_thread, channel: public_channel, original_message: existing_message)
|
|
|
|
chat_page.visit_thread(thread)
|
|
thread_page.open_original_message
|
|
|
|
expect(channel_page.messages).to have_message(id: thread.original_message.id, highlighted: true)
|
|
end
|
|
end
|