FEATURE: Chat and Sidebar are now on by default (#19406)
FEATURE: Chat and Sidebar are now on by default - Set the sidebar site setting to be enabled by default - Set the chat site setting to be enabled by default - Updated existing specs that assumed the original default - Use a migration to keep old defaults for existing sites
This commit is contained in:
parent
aa3a9b6fea
commit
5c925f2db3
|
@ -25,6 +25,9 @@ acceptance("Enforce Second Factor", function (needs) {
|
|||
});
|
||||
});
|
||||
});
|
||||
needs.settings({
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
|
||||
test("as an admin", async function (assert) {
|
||||
await visit("/u/eviltrout/preferences/second-factor");
|
||||
|
|
|
@ -14,6 +14,9 @@ acceptance(
|
|||
needs.pretender((server, helper) => {
|
||||
server.get("/review/count.json", () => helper.response({ count: 3 }));
|
||||
});
|
||||
needs.settings({
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
test("As a staff member", async function (assert) {
|
||||
updateCurrentUser({ moderator: true, admin: false });
|
||||
|
||||
|
@ -28,7 +31,10 @@ acceptance(
|
|||
}
|
||||
);
|
||||
|
||||
acceptance("Hamburger Menu accessibility", function () {
|
||||
acceptance("Hamburger Menu accessibility", function (needs) {
|
||||
needs.settings({
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
test("Escape key closes hamburger menu", async function (assert) {
|
||||
await visit("/");
|
||||
await click("#toggle-hamburger-menu");
|
||||
|
|
|
@ -8,6 +8,9 @@ acceptance("Opengraph Tag Updater", function (needs) {
|
|||
return helper.response({});
|
||||
});
|
||||
});
|
||||
needs.settings({
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
|
||||
test("updates OG title and URL", async function (assert) {
|
||||
await visit("/");
|
||||
|
|
|
@ -2060,7 +2060,7 @@ developer:
|
|||
navigation:
|
||||
navigation_menu:
|
||||
client: true
|
||||
default: "legacy"
|
||||
default: "sidebar"
|
||||
type: enum
|
||||
enum: "NavigationMenuSiteSetting"
|
||||
default_sidebar_categories:
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class EnableSidebarAndChat < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
result = execute <<~SQL
|
||||
SELECT created_at
|
||||
FROM schema_migration_details
|
||||
ORDER BY created_at
|
||||
LIMIT 1
|
||||
SQL
|
||||
|
||||
# keep sidebar legacy and chat disabled for for existing sites
|
||||
if result.first['created_at'].to_datetime < 1.hour.ago
|
||||
execute <<~SQL
|
||||
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||
VALUES('chat_enabled', 5, 'f', NOW(), NOW())
|
||||
ON CONFLICT (name) DO NOTHING
|
||||
SQL
|
||||
execute <<~SQL
|
||||
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||
VALUES('navigation_menu', 7, 'legacy', NOW(), NOW())
|
||||
ON CONFLICT (name) DO NOTHING
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
chat:
|
||||
chat_enabled:
|
||||
default: false
|
||||
default: true
|
||||
client: true
|
||||
chat_allowed_groups:
|
||||
client: true
|
||||
|
|
|
@ -14,6 +14,8 @@ describe Jobs::EmailChatNotifications do
|
|||
end
|
||||
|
||||
context "when chat is not enabled" do
|
||||
before { SiteSetting.chat_enabled = false }
|
||||
|
||||
it "does nothing" do
|
||||
Chat::ChatMailer.expects(:send_unread_mentions_summary).never
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ RSpec.describe "Navigation", type: :system, js: true do
|
|||
before do
|
||||
chat_system_bootstrap(user, [category_channel, category_channel_2])
|
||||
sign_in(user)
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
end
|
||||
|
||||
context "when sidebar is enabled as the navigation menu" do
|
||||
|
|
|
@ -15,6 +15,7 @@ acceptance("Discourse Chat - Chat live pane", function (needs) {
|
|||
});
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
needs.pretender((server, helper) => {
|
||||
server.get("/chat/:chatChannelId/messages.json", () =>
|
||||
|
|
|
@ -37,6 +37,7 @@ acceptance(
|
|||
});
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
|
||||
let loadAllMessages = false;
|
||||
|
@ -195,6 +196,7 @@ acceptance(
|
|||
});
|
||||
needs.settings({
|
||||
chat_enabled: true,
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
|
|
|
@ -61,6 +61,7 @@ acceptance(
|
|||
needs.settings({
|
||||
chat_enabled: true,
|
||||
chat_allow_archiving_channels: true,
|
||||
navigation_menu: "legacy",
|
||||
});
|
||||
|
||||
needs.pretender((server, helper) => {
|
||||
|
|
|
@ -168,6 +168,7 @@ RSpec.describe Jobs::NotifyReviewable do
|
|||
end
|
||||
|
||||
it "respects priority" do
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
SiteSetting.enable_category_group_moderation = true
|
||||
Reviewable.set_priorities(medium: 2.0)
|
||||
SiteSetting.reviewable_default_visibility = 'medium'
|
||||
|
|
|
@ -594,6 +594,7 @@ RSpec.describe TopicTrackingState do
|
|||
end
|
||||
|
||||
it "includes tags when SiteSetting.navigation_menu is not legacy" do
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
report = TopicTrackingState.report(user)
|
||||
expect(report.length).to eq(1)
|
||||
row = report[0]
|
||||
|
@ -608,6 +609,7 @@ RSpec.describe TopicTrackingState do
|
|||
end
|
||||
|
||||
it "includes tags when TopicTrackingState.include_tags_in_report option is enabled" do
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
report = TopicTrackingState.report(user)
|
||||
expect(report.length).to eq(1)
|
||||
row = report[0]
|
||||
|
|
|
@ -9,6 +9,7 @@ RSpec.describe 'users' do
|
|||
|
||||
before do
|
||||
SiteSetting.tagging_enabled = true
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
Jobs.run_immediately!
|
||||
sign_in(admin)
|
||||
end
|
||||
|
|
|
@ -4,6 +4,11 @@ RSpec.describe TopicTrackingStateSerializer do
|
|||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:post) { create_post }
|
||||
|
||||
before do
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
SiteSetting.chat_enabled = false if defined?(::Chat)
|
||||
end
|
||||
|
||||
it 'serializes topic tracking state reports' do
|
||||
report = TopicTrackingState.report(user)
|
||||
serialized = described_class.new(report[0], scope: Guardian.new(user), root: false).as_json
|
||||
|
|
|
@ -13,6 +13,11 @@ RSpec.describe WebHookUserSerializer do
|
|||
WebHookUserSerializer.new(user, scope: Guardian.new(admin), root: false)
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.navigation_menu = "legacy"
|
||||
SiteSetting.chat_enabled = false if defined?(::Chat)
|
||||
end
|
||||
|
||||
it "should include relevant user info" do
|
||||
payload = serializer.as_json
|
||||
expect(payload[:email]).to eq(user.email)
|
||||
|
|
Loading…
Reference in New Issue