FIX: Display new DM button when public channels are disabled (#28306)

This commit is contained in:
Mark VanLandingham
2024-08-12 08:44:51 -05:00
committed by GitHub
parent 1d6e54e54c
commit 79f871b558
6 changed files with 70 additions and 33 deletions

View File

@@ -123,4 +123,25 @@ RSpec.describe "List channels | no sidebar", type: :system do
expect(page).to have_no_css(".direct-message-channels-section")
end
end
context "when public channels are disabled" do
before { SiteSetting.enable_public_channels = false }
it "shows the create direct message button" do
visit("/chat")
expect(chat).to have_direct_message_channels_section
end
context "with drawer prefered" do
before { chat.prefers_drawer }
it "shows the create direct message button in the drawer" do
visit("/")
chat.open_from_header
expect(PageObjects::Pages::ChatDrawer.new).to have_direct_message_channels_section
end
end
end
end

View File

@@ -134,6 +134,10 @@ module PageObjects
have_selector(".channel-list-empty-message")
end
def has_direct_message_channels_section?
has_css?(".direct-message-channels-section")
end
private
def drawer?(expectation:, channel_id: nil, expanded: true)

View File

@@ -145,6 +145,10 @@ module PageObjects
has_no_css?("#{thread_list_button_selector}.has-unreads")
end
def has_direct_message_channels_section?
has_css?(".direct-message-channels-section")
end
private
def mouseout