FIX: ensures chat sidebar is present when core sidebar is disabled (#19197)
This commit is contained in:
parent
34f4d51238
commit
637fb9831b
|
@ -1,12 +1,25 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default class ChatController extends Controller {
|
||||
@service chat;
|
||||
|
||||
@action
|
||||
switchChannel(channel) {
|
||||
this.chat.openChannel(channel);
|
||||
get shouldUseChatSidebar() {
|
||||
if (this.site.mobileView) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.shouldUseCoreSidebar) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
get shouldUseCoreSidebar() {
|
||||
return (
|
||||
this.siteSettings.enable_sidebar &&
|
||||
this.siteSettings.enable_experimental_sidebar_hamburger
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,15 +11,13 @@
|
|||
class={{concat-class
|
||||
"full-page-chat"
|
||||
(if
|
||||
this.siteSettings.enable_sidebar
|
||||
this.shouldUseCoreSidebar
|
||||
"full-page-chat-sidebar-enabled"
|
||||
)
|
||||
}}
|
||||
>
|
||||
{{#if
|
||||
(and (not this.siteSettings.enable_sidebar) (not this.site.mobileView))
|
||||
}}
|
||||
<ChannelsList @onSelect={{action "switchChannel"}} />
|
||||
{{#if this.shouldUseChatSidebar}}
|
||||
<ChannelsList />
|
||||
{{/if}}
|
||||
|
||||
<div id="main-chat-outlet">
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe "Navigation", type: :system, js: true do
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:topic) { Fabricate(:topic) }
|
||||
fab!(:post) { Fabricate(:post, topic: topic) }
|
||||
fab!(:user) { Fabricate(:admin) }
|
||||
fab!(:category_channel) { Fabricate(:category_channel) }
|
||||
fab!(:category_channel_2) { Fabricate(:category_channel) }
|
||||
let(:chat_page) { PageObjects::Pages::Chat.new }
|
||||
|
||||
before do
|
||||
chat_system_bootstrap(user, [category_channel, category_channel_2])
|
||||
sign_in(user)
|
||||
end
|
||||
|
||||
context "when core sidebar is enabled" do
|
||||
before do
|
||||
SiteSetting.enable_sidebar = true
|
||||
SiteSetting.enable_experimental_sidebar_hamburger = true
|
||||
end
|
||||
|
||||
it "uses core sidebar" do
|
||||
visit("/chat")
|
||||
|
||||
expect(page).to have_css("#d-sidebar")
|
||||
expect(page).to_not have_css(".channels-list")
|
||||
end
|
||||
|
||||
context "when visiting on mobile" do
|
||||
it "has no sidebar" do
|
||||
visit("/?mobile_view=1")
|
||||
chat_page.visit_channel(category_channel_2)
|
||||
|
||||
expect(page).to_not have_css("#d-sidebar")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it "uses chat sidebar" do
|
||||
visit("/chat")
|
||||
|
||||
expect(page).to have_css(".channels-list")
|
||||
expect(page).to_not have_css("#d-sidebar")
|
||||
end
|
||||
|
||||
context "when visiting on mobile" do
|
||||
it "has no sidebar" do
|
||||
visit("/?mobile_view=1")
|
||||
chat_page.visit_channel(category_channel_2)
|
||||
|
||||
expect(page).to_not have_css(".channels-list")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue