Skip to content

A platform for community discussion. Free, open, simple.

DEV: Migrate sidebar site settings (#19336)

Alan Guo Xiang Tanfde9e6bc2522
diff --git a/app/assets/javascripts/discourse/app/components/site-header.js b/app/assets/javascripts/discourse/app/components/site-header.js
index d1609ca0eef..b8c146d9325 100644
--- a/app/assets/javascripts/discourse/app/components/site-header.js
+++ b/app/assets/javascripts/discourse/app/components/site-header.js
@@ -43,10 +43,8 @@ const SiteHeaderComponent = MountWidget.extend(
@observes("site.narrowDesktopView")
narrowDesktopViewChanged() {
this.eventDispatched("dom:clean", "header");
- if (
- this.siteSettings.enable_experimental_sidebar_hamburger &&
- (!this.sidebarEnabled || this.site.narrowDesktopView)
- ) {
+
+ if (this._dropDownHeaderEnabled()) {
this.appEvents.on(
"sidebar-hamburger-dropdown:rendered",
this,
@@ -232,10 +230,7 @@ const SiteHeaderComponent = MountWidget.extend(
this.appEvents.on("user-menu:rendered", this, "_animateMenu");
}
- if (
- this.siteSettings.enable_experimental_sidebar_hamburger &&
- (!this.sidebarEnabled || this.site.narrowDesktopView)
- ) {
+ if (this._dropDownHeaderEnabled()) {
this.appEvents.on(
"sidebar-hamburger-dropdown:rendered",
this,
@@ -324,10 +319,7 @@ const SiteHeaderComponent = MountWidget.extend(
this.appEvents.off("user-menu:rendered", this, "_animateMenu");
}
- if (
- this.siteSettings.enable_experimental_sidebar_hamburger &&
- !this.sidebarEnabled
- ) {
+ if (this._dropDownHeaderEnabled()) {
this.appEvents.off(
"sidebar-hamburger-dropdown:rendered",
this,
@@ -469,6 +461,14 @@ const SiteHeaderComponent = MountWidget.extend(
this._animate = false;
});
},
+
+ _dropDownHeaderEnabled() {
+ return (
+ (!this.sidebarEnabled &&
+ this.siteSettings.navigation_menu !== "legacy") ||
+ this.site.narrowDesktopView
+ );
+ },
}
);
diff --git a/app/assets/javascripts/discourse/app/components/user-nav/preferences-nav.hbs b/app/assets/javascripts/discourse/app/components/user-nav/preferences-nav.hbs
index 45a007b6c3f..c097edb7b78 100644
--- a/app/assets/javascripts/discourse/app/components/user-nav/preferences-nav.hbs
+++ b/app/assets/javascripts/discourse/app/components/user-nav/preferences-nav.hbs
@@ -56,7 +56,7 @@
</LinkTo>
</li>
-{{#if @siteSettings.enable_experimental_sidebar_hamburger}}
+{{#if (not (eq @siteSettings.navigation_menu "legacy"))}}
<li class="indent nav-sidebar">
<LinkTo @route="preferences.sidebar">
{{d-icon "bars"}}
diff --git a/app/assets/javascripts/discourse/app/controllers/application.js b/app/assets/javascripts/discourse/app/controllers/application.js
index 567340e643c..1c775ad51bb 100644
--- a/app/assets/javascripts/discourse/app/controllers/application.js
+++ b/app/assets/javascripts/discourse/app/controllers/application.js
@@ -64,13 +64,13 @@ export default Controller.extend({
@discourseComputed(
"sidebarQueryParamOverride",
- "siteSettings.enable_sidebar",
+ "siteSettings.navigation_menu",
"canDisplaySidebar",
"sidebarDisabledRouteOverride"
)
sidebarEnabled(
sidebarQueryParamOverride,
- enableSidebar,
+ navigationMenu,
canDisplaySidebar,
sidebarDisabledRouteOverride
) {
@@ -95,7 +95,7 @@ export default Controller.extend({
return false;
}
- return enableSidebar;
+ return navigationMenu === "sidebar";
},
calculateShowSidebar() {
diff --git a/app/assets/javascripts/discourse/app/lib/plugin-api.js b/app/assets/javascripts/discourse/app/lib/plugin-api.js
index 91e666becb6..78cebdfc2c9 100644
--- a/app/assets/javascripts/discourse/app/lib/plugin-api.js
+++ b/app/assets/javascripts/discourse/app/lib/plugin-api.js
@@ -509,7 +509,7 @@ class PluginApi {
) {
const siteSettings = this.container.lookup("service:site-settings");
- if (siteSettings.enable_experimental_sidebar_hamburger) {
+ if (siteSettings.navigation_menu !== "legacy") {
try {
const { href, route, label, rawLabel, className } = fn();
const textContent = rawLabel || I18n.t(label);
@@ -534,7 +534,7 @@ class PluginApi {
this.addCommunitySectionLink(args, name.match(/footerLinks/));
} catch {
deprecated(
- `Usage of \`api.decorateWidget('hamburger-menu:generalLinks')\` is incompatible with the \`enable_experimental_sidebar_hamburger\` site setting. Please use \`api.addCommunitySectionLink\` instead.`,
+ `Usage of \`api.decorateWidget('hamburger-menu:generalLinks')\` is incompatible with the \`navigation_menu\` site setting when not set to "legacy". Please use \`api.addCommunitySectionLink\` instead.`,
{ id: "discourse.decorate-widget.hamburger-widget-links" }
);
}
diff --git a/app/assets/javascripts/discourse/app/templates/application.hbs b/app/assets/javascripts/discourse/app/templates/application.hbs
index 9c462727a61..40dde7214f5 100644
--- a/app/assets/javascripts/discourse/app/templates/application.hbs
+++ b/app/assets/javascripts/discourse/app/templates/application.hbs
@@ -25,7 +25,7 @@
<div class="sidebar-wrapper">
{{!-- empty div allows for animation --}}
- {{#if (and this.siteSettings.enable_experimental_sidebar_hamburger this.sidebarEnabled this.showSidebar)}}
+ {{#if (and this.sidebarEnabled this.showSidebar)}}
<Sidebar @toggleSidebar={{action "toggleSidebar"}}/>
{{/if}}
</div>
diff --git a/app/assets/javascripts/discourse/app/templates/preferences.hbs b/app/assets/javascripts/discourse/app/templates/preferences.hbs
index 21758e3d4ff..c39afcbb8b3 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences.hbs
+++ b/app/assets/javascripts/discourse/app/templates/preferences.hbs
@@ -61,7 +61,7 @@
</LinkTo>
</li>
- {{#if this.siteSettings.enable_experimental_sidebar_hamburger}}
+ {{#if (not (eq @siteSettings.navigation_menu "legacy"))}}
<li class="indent nav-sidebar">
<LinkTo @route="preferences.sidebar">
{{i18n "user.preferences_nav.sidebar"}}
diff --git a/app/assets/javascripts/discourse/app/widgets/header-contents.js b/app/assets/javascripts/discourse/app/widgets/header-contents.js
index 7a5ccf8df4e..ba579498dad 100644
--- a/app/assets/javascripts/discourse/app/widgets/header-contents.js
+++ b/app/assets/javascripts/discourse/app/widgets/header-contents.js
@@ -5,16 +5,17 @@ createWidget("header-contents", {
tagName: "div.contents.clearfix",
template: hbs`
{{#if this.site.desktopView}}
- {{#if this.siteSettings.enable_experimental_sidebar_hamburger}}
- {{#if attrs.sidebarEnabled}}
- {{sidebar-toggle attrs=attrs}}
- {{/if}}
+ {{#if attrs.sidebarEnabled}}
+ {{sidebar-toggle attrs=attrs}}
{{/if}}
{{/if}}
+
{{home-logo attrs=attrs}}
+
{{#if attrs.topic}}
{{header-topic-info attrs=attrs}}
{{/if}}
+
<div class="panel clearfix" role="navigation">{{yield}}</div>
`,
});
diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index 81f705a2e69..01c19101121 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -324,9 +324,8 @@ createWidget("header-icons", {
});
if (
- !this.siteSettings.enable_experimental_sidebar_hamburger ||
- (this.siteSettings.enable_experimental_sidebar_hamburger &&
- !attrs.sidebarEnabled) ||
+ this.siteSettings.navigation_menu === "legacy" ||
+ !attrs.sidebarEnabled ||
this.site.mobileView
) {
icons.push(hamburger);
@@ -498,7 +497,7 @@ export default createWidget("header", {
})
);
} else if (state.hamburgerVisible) {
- if (this.siteSettings.enable_experimental_sidebar_hamburger) {
+ if (this.siteSettings.navigation_menu !== "legacy") {
if (!attrs.sidebarEnabled || this.site.narrowDesktopView) {
panels.push(this.attach("revamped-hamburger-menu-wrapper", {}));
}
@@ -613,7 +612,7 @@ export default createWidget("header", {
toggleHamburger() {
if (
- this.siteSettings.enable_experimental_sidebar_hamburger &&
+ this.siteSettings.navigation_menu !== "legacy" &&
this.attrs.sidebarEnabled &&
!this.site.narrowDesktopView
) {
@@ -623,7 +622,7 @@ export default createWidget("header", {
this.toggleBodyScrolling(this.state.hamburgerVisible);
schedule("afterRender", () => {
- if (this.siteSettings.enable_experimental_sidebar_hamburger) {
+ if (this.siteSettings.navigation_menu !== "legacy") {
// Remove focus from hamburger toggle button
document.querySelector("#toggle-hamburger-menu")?.blur();
} else {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/second-factor-auth-test.js b/app/assets/javascripts/discourse/tests/acceptance/second-factor-auth-test.js
index 32b57a7e6d7..a1a04511ebb 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/second-factor-auth-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/second-factor-auth-test.js
@@ -285,8 +285,7 @@ acceptance("Second Factor Auth Page", function (needs) {
});
test("sidebar is disabled on 2FA route", async function (assert) {
- this.siteSettings.enable_experimental_sidebar_hamburger = true;
- this.siteSettings.enable_sidebar = true;
+ this.siteSettings.navigation_menu = "sidebar";
await visit("/session/2fa?nonce=ok110111");
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-categories-section-test.js
index 9ec6b59826d..252a8e756b8 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-categories-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-categories-section-test.js
@@ -9,8 +9,7 @@ import Site from "discourse/models/site";
acceptance("Sidebar - Anonymous - Categories Section", function (needs) {
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
test("category section links ordered by category's topic count when default_sidebar_categories has not been configured and site setting to fix categories positions is disabled", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-community-section-test.js
index c01d2357d97..28d186a8f5b 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-community-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-community-section-test.js
@@ -12,8 +12,7 @@ import { click, visit } from "@ember/test-helpers";
acceptance("Sidebar - Anonymous user - Community Section", function (needs) {
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
test("display short site description site setting when it is set", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-tags-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-tags-section-test.js
index 09d805069b4..715f08aa5f5 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-tags-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-tags-section-test.js
@@ -9,8 +9,7 @@ import Site from "discourse/models/site";
acceptance("Sidebar - Anonymous Tags Section", function (needs) {
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
suppress_uncategorized_badge: false,
tagging_enabled: true,
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-user-test.js
index d350dd1aaa3..f6de25ef9d8 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-anonymous-user-test.js
@@ -6,8 +6,7 @@ import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
acceptance("Sidebar - Anonymous User", function (needs) {
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
test("sidebar is displayed", async function (assert) {
@@ -30,7 +29,7 @@ acceptance("Sidebar - Anonymous User", function (needs) {
});
test("sidebar hamburger panel dropdown when sidebar has been disabled", async function (assert) {
- this.siteSettings.enable_sidebar = false;
+ this.siteSettings.navigation_menu = "header dropdown";
await visit("/");
await click(".hamburger-dropdown");
@@ -44,8 +43,7 @@ acceptance("Sidebar - Anonymous User", function (needs) {
acceptance("Sidebar - Anonymous User - Login Required", function (needs) {
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
login_required: true,
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-mobile-test.js
index 3241278e81b..071a1bb5cc3 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-mobile-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-mobile-test.js
@@ -9,8 +9,7 @@ acceptance("Sidebar - Mobile - User with sidebar enabled", function (needs) {
needs.user();
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.mobileView();
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js
index defbd86a7a6..7ac9ef275fb 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-narrow-desktop-test.js
@@ -8,8 +8,7 @@ acceptance("Sidebar - Narrow Desktop", function (needs) {
needs.user();
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
test("wide sidebar is changed to cloak when resize to narrow screen", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js
index 511f6f1b297..489972f675f 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js
@@ -14,8 +14,7 @@ acceptance("Sidebar - Plugin API", function (needs) {
needs.user();
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.hooks.afterEach(() => {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js
index 3b4a14cd4cb..dd182b99b9c 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js
@@ -22,8 +22,7 @@ acceptance(
function (needs) {
needs.settings({
allow_uncategorized_topics: false,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.user({ admin: false });
@@ -66,8 +65,7 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
});
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
suppress_uncategorized_badge: false,
allow_uncategorized_topics: true,
});
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js
index 47c505d2f37..41756649fe8 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js
@@ -28,8 +28,7 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {
});
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.pretender((server, helper) => {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js
index fb7c120e10a..6ae22561611 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-messages-section-test.js
@@ -22,8 +22,7 @@ acceptance(
});
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
test("clicking on section header button", async function (assert) {
@@ -43,8 +42,7 @@ acceptance(
needs.user({ can_send_private_messages: true });
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.pretender((server, helper) => {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js
index 7b80114b9cc..018d7d3b232 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js
@@ -19,8 +19,7 @@ acceptance(
function (needs) {
needs.settings({
tagging_enabled: false,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.user();
@@ -39,8 +38,7 @@ acceptance(
acceptance("Sidebar - Logged on user - Tags section", function (needs) {
needs.settings({
tagging_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.user({
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
index 8f80d85dc30..ed2b4c5db32 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
@@ -14,7 +14,7 @@ acceptance(
needs.user();
needs.settings({
- enable_experimental_sidebar_hamburger: false,
+ navigation_menu: "legacy",
});
test("clicking header hamburger icon displays old hamburger dropdown", async function (assert) {
@@ -32,8 +32,7 @@ acceptance(
needs.user();
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: false,
+ navigation_menu: "header dropdown",
});
test("showing and hiding sidebar", async function (assert) {
@@ -80,8 +79,7 @@ acceptance(
needs.user();
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
test("viewing keyboard shortcuts using sidebar", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js
index 85db3fbb62b..02eb2773dd6 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-sidebar-test.js
@@ -17,8 +17,7 @@ acceptance("User Preferences - Sidebar", function (needs) {
});
needs.settings({
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
tagging_enabled: true,
});
diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb
index ca7e548a70d..2006ddedddb 100644
--- a/app/controllers/notifications_controller.rb
+++ b/app/controllers/notifications_controller.rb
@@ -31,12 +31,13 @@ class NotificationsController < ApplicationController
limit = 50 if limit > 50
include_reviewables = false
- if SiteSetting.enable_experimental_sidebar_hamburger
+
+ if SiteSetting.legacy_navigation_menu?
+ notifications = Notification.recent_report(current_user, limit, notification_types)
+ else
notifications = Notification.prioritized_list(current_user, count: limit, types: notification_types)
# notification_types is blank for the "all notifications" user menu tab
include_reviewables = notification_types.blank? && guardian.can_see_review_queue?
- else
- notifications = Notification.recent_report(current_user, limit, notification_types)
end
if notifications.present? && !(params.has_key?(:silent) || @readonly_mode)
@@ -63,12 +64,14 @@ class NotificationsController < ApplicationController
notifications: serialize_data(notifications, NotificationSerializer),
seen_notification_id: current_user.seen_notification_id
}
+
if include_reviewables
json[:pending_reviewables] = Reviewable.basic_serializers_for_list(
Reviewable.user_menu_list_for(current_user),
current_user
).as_json
end
+
render_json_dump(json)
else
offset = params[:offset].to_i
diff --git a/app/controllers/reviewable_claimed_topics_controller.rb b/app/controllers/reviewable_claimed_topics_controller.rb
index 1669c3751d4..2a6033118ba 100644
--- a/app/controllers/reviewable_claimed_topics_controller.rb
+++ b/app/controllers/reviewable_claimed_topics_controller.rb
@@ -51,7 +51,8 @@ class ReviewableClaimedTopicsController < ApplicationController
end
MessageBus.publish("/reviewable_claimed", data, group_ids: group_ids.to_a)
- if SiteSetting.enable_experimental_sidebar_hamburger
+
+ if !SiteSetting.legacy_navigation_menu?
Jobs.enqueue(:refresh_users_reviewable_counts, group_ids: group_ids.to_a)
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 8dc4cca7e75..1cc1d0e2b4f 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1870,7 +1870,7 @@ class UsersController < ApplicationController
permitted.concat UserUpdater::TAG_NAMES.keys
permitted << UserUpdater::NOTIFICATION_SCHEDULE_ATTRS
- if SiteSetting.enable_experimental_sidebar_hamburger
+ if !SiteSetting.legacy_navigation_menu?
if params.has_key?(:sidebar_category_ids) && params[:sidebar_category_ids].blank?
params[:sidebar_category_ids] = []
end
diff --git a/app/jobs/regular/notify_reviewable.rb b/app/jobs/regular/notify_reviewable.rb
index cbfc37431df..5b71ac557e1 100644
--- a/app/jobs/regular/notify_reviewable.rb
+++ b/app/jobs/regular/notify_reviewable.rb
@@ -31,31 +31,31 @@ class Jobs::NotifyReviewable < ::Jobs::Base
counts[r.reviewable_by_group_id] += 1 if r.reviewable_by_group_id
end
- if SiteSetting.enable_experimental_sidebar_hamburger
- notify_users(
- User.real.admins,
- all_updates[:admins]
- )
- else
+ if SiteSetting.legacy_navigation_menu?
notify_legacy(
User.real.admins.pluck(:id),
count: counts[:admins],
updates: all_updates[:admins],
)
+ else
+ notify_users(
+ User.real.admins,
+ all_updates[:admins]
+ )
end
if reviewable.reviewable_by_moderator?
- if SiteSetting.enable_experimental_sidebar_hamburger
- notify_users(
- User.real.moderators.where("id NOT IN (?)", @contacted),
- all_updates[:moderators]
- )
- else
+ if SiteSetting.legacy_navigation_menu?
notify_legacy(
User.real.moderators.where("id NOT IN (?)", @contacted).pluck(:id),
count: counts[:moderators],
updates: all_updates[:moderators],
)
+ else
+ notify_users(
+ User.real.moderators.where("id NOT IN (?)", @contacted),
+ all_updates[:moderators]
+ )
end
end
@@ -70,10 +70,10 @@ class Jobs::NotifyReviewable < ::Jobs::Base
count += counts[gu.group_id]
end
- if SiteSetting.enable_experimental_sidebar_hamburger
- notify_user(user, updates)
- else
+ if SiteSetting.legacy_navigation_menu?
notify_legacy([user.id], count: count, updates: updates)
+ else
+ notify_user(user, updates)
end
end
diff --git a/app/models/navigation_menu_site_setting.rb b/app/models/navigation_menu_site_setting.rb
new file mode 100644
index 00000000000..d71cac2fdd2
--- /dev/null
+++ b/app/models/navigation_menu_site_setting.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class NavigationMenuSiteSetting < EnumSiteSetting
+ SIDEBAR = "sidebar"
+ HEADER_DROPDOWN = "header dropdown"
+ LEGACY = "legacy"
+
+ def self.valid_value?(val)
+ values.any? { |v| v[:value] == val }
+ end
+
+ def self.values
+ @values ||= [
+ { name: "admin.navigation_menu.sidebar", value: SIDEBAR },
+ { name: "admin.navigation_menu.header_dropdown", value: HEADER_DROPDOWN },
+ { name: "admin.navigation_menu.legacy", value: LEGACY }
+ ]
+ end
+
+ def self.translate_names?
+ true
+ end
+end
diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb
index 7ec4016dc13..b87146e52d6 100644
--- a/app/models/site_setting.rb
+++ b/app/models/site_setting.rb
@@ -237,6 +237,10 @@ class SiteSetting < ActiveRecord::Base
c.present? && c.to_i != SiteSetting.uncategorized_category_id.to_i
end
+ def self.legacy_navigation_menu?
+ SiteSetting.navigation_menu == "legacy"
+ end
+
ALLOWLIST_DEPRECATED_SITE_SETTINGS = {
'email_domains_blacklist': 'blocked_email_domains',
'email_domains_whitelist': 'allowed_email_domains',
diff --git a/app/models/topic_tracking_state.rb b/app/models/topic_tracking_state.rb
index bc25cf92817..65bf2fa59ca 100644
--- a/app/models/topic_tracking_state.rb
+++ b/app/models/topic_tracking_state.rb
@@ -276,7 +276,7 @@ class TopicTrackingState
end
def self.include_tags_in_report?
- SiteSetting.tagging_enabled && (@include_tags_in_report || SiteSetting.enable_experimental_sidebar_hamburger)
+ SiteSetting.tagging_enabled && (@include_tags_in_report || !SiteSetting.legacy_navigation_menu?)
end
def self.include_tags_in_report=(v)
diff --git a/app/models/user.rb b/app/models/user.rb
index 766ef7bf8d0..605638f390a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1719,7 +1719,7 @@ class User < ActiveRecord::Base
end
def redesigned_user_menu_enabled?
- SiteSetting.enable_experimental_sidebar_hamburger
+ !SiteSetting.legacy_navigation_menu?
end
protected
@@ -1951,7 +1951,7 @@ class User < ActiveRecord::Base
private
def set_default_sidebar_section_links(update: false)
- return if !SiteSetting.enable_experimental_sidebar_hamburger
+ return if SiteSetting.legacy_navigation_menu?
return if staged? || bot?
if SiteSetting.default_sidebar_categories.present?
diff --git a/app/serializers/concerns/user_sidebar_tags_mixin.rb b/app/serializers/concerns/user_sidebar_tags_mixin.rb
index 05fa60afdab..bcdfc3c93fb 100644
--- a/app/serializers/concerns/user_sidebar_tags_mixin.rb
+++ b/app/serializers/concerns/user_sidebar_tags_mixin.rb
@@ -26,6 +26,6 @@ module UserSidebarTagsMixin
end
def include_display_sidebar_tags?
- SiteSetting.tagging_enabled && SiteSetting.enable_experimental_sidebar_hamburger
+ SiteSetting.tagging_enabled && !SiteSetting.legacy_navigation_menu?
end
end
diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb
index 59c01074d38..6a6f7f8febd 100644
--- a/app/serializers/current_user_serializer.rb
+++ b/app/serializers/current_user_serializer.rb
@@ -258,7 +258,7 @@ class CurrentUserSerializer < BasicUserSerializer
end
def include_sidebar_category_ids?
- SiteSetting.enable_experimental_sidebar_hamburger
+ !SiteSetting.legacy_navigation_menu?
end
def include_status?
diff --git a/app/serializers/site_serializer.rb b/app/serializers/site_serializer.rb
index d460244b284..53c23bcf480 100644
--- a/app/serializers/site_serializer.rb
+++ b/app/serializers/site_serializer.rb
@@ -243,7 +243,7 @@ class SiteSerializer < ApplicationSerializer
end
def include_anonymous_default_sidebar_tags?
- scope.anonymous? && SiteSetting.enable_experimental_sidebar_hamburger && SiteSetting.tagging_enabled && SiteSetting.default_sidebar_tags.present?
+ scope.anonymous? && !SiteSetting.legacy_navigation_menu? && SiteSetting.tagging_enabled && SiteSetting.default_sidebar_tags.present?
end
private
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 35997ff14a3..5902478635f 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -4678,6 +4678,11 @@ en:
official: "Official Plugin"
broken_route: "Unable to configure link to '%{name}'. Ensure ad-blockers are disabled and try reloading the page."
+ navigation_menu:
+ sidebar: "Sidebar"
+ header_dropdown: "Header Dropdown"
+ legacy: "Legacy"
+
backups:
title: "Backups"
menu:
@@ -5724,7 +5729,7 @@ en:
search: "Search"
groups: "Groups"
dashboard: "Dashboard"
- sidebar: "Sidebar"
+ navigation: "Navigation"
secret_list:
invalid_input: "Input fields cannot be empty or contain vertical bar character."
default_categories:
diff --git a/config/locales/server.ar.yml b/config/locales/server.ar.yml
index fa620719be1..6b84b4a4ebf 100644
--- a/config/locales/server.ar.yml
+++ b/config/locales/server.ar.yml
@@ -1870,8 +1870,6 @@ ar:
top_topics_formula_first_post_likes_multiplier: "قيمة مُضاعِف تسجيلات الإعجاب على أول منشور (n) في معادلة الموضوعات الأكثر نشاطًا: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "قيمة أقل عدد من تسجيلات الإعجاب لكل مُضاعِف منشورات (n) في معادلة الموضوعات الأكثر نشاطًا: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "السماح للمستخدمين بالدخول إلى الوضع الآمن لتصحيح أخطاء المكوِّنات الإضافية"
- enable_experimental_sidebar_hamburger: "يسمح بتفعيل الشريط الجانبي التجريبي وقائمة الثلاث شرط المنسدلة."
- enable_sidebar: "يفعِّل الشريط الجانبي التجريبي."
rate_limit_create_topic: "بعد إنشاء موضوع، يجب على المستخدمين الانتظار (n) ثانية قبل إنشاء موضوع آخر."
rate_limit_create_post: "بعد النشر، يجب على المستخدمين الانتظار (n) ثانية قبل إنشاء منشور آخر."
rate_limit_new_user_create_topic: "بعد إنشاء موضوع، يجب على المستخدمين الجُدد الانتظار (n) ثانية قبل إنشاء موضوع آخر."
diff --git a/config/locales/server.de.yml b/config/locales/server.de.yml
index dfd8dbf9d89..563d29a21df 100644
--- a/config/locales/server.de.yml
+++ b/config/locales/server.de.yml
@@ -1662,8 +1662,6 @@ de:
top_topics_formula_first_post_likes_multiplier: "Wert des Multiplikators (n) für die „Gefällt mir“-Angaben des ersten Beitrags in der Formel für angesagte Themen: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "Wert des Multiplikators (n) für die wenigsten „Gefällt mir“-Angaben pro Beitrag in der Formel für angesagte Themen: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Erlaube Benutzern, den abgesicherten Modus zu betreten, um Plug-ins zu debuggen."
- enable_experimental_sidebar_hamburger: "Ermöglicht die Aktivierung der experimentellen Seitenleiste und des Benutzer-Hamburger-Drop-down-Menüs."
- enable_sidebar: "Aktiviert die experimentelle Seitenleiste."
rate_limit_create_topic: "Nach Erstellen eines Themas muss ein Benutzer (n) Sekunden warten, bevor ein weiteres Thema erstellt werden kann."
rate_limit_create_post: "Nach Schreiben eines Beitrags muss ein Benutzer (n) Sekunden warten, bevor ein weiterer Beitrag erstellt werden kann."
rate_limit_new_user_create_topic: "Nach Erstellen eines Themas muss ein neuer Benutzer (n) Sekunden warten, bevor ein weiteres Thema erstellt werden kann."
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index fdc414c0d44..2daf9b790cd 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -1792,8 +1792,6 @@ en:
top_topics_formula_least_likes_per_post_multiplier: "value of least likes per post multiplier (n) in top topics formula: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Allow users to enter safe mode to debug plugins."
- enable_experimental_sidebar_hamburger: "Allows experimental sidebar and user hamburger dropdown menu to be enabled."
- enable_sidebar: "Enables experimental sidebar."
rate_limit_create_topic: "After creating a topic, users must wait (n) seconds before creating another topic."
rate_limit_create_post: "After posting, users must wait (n) seconds before creating another post."
@@ -2390,6 +2388,7 @@ en:
suggest_weekends_in_date_pickers: "Include weekends (Saturday and Sunday) in date picker suggestions (disable this if you use Discourse only on weekdays, Monday through Friday)."
splash_screen: "Displays a temporary loading screen while site assets load"
+ navigation_menu: "Determine which navigation menu to be used for the site."
default_sidebar_categories: "Selected categories will be displayed under Sidebar's Categories section by default."
default_sidebar_tags: "Selected tags will be displayed under Sidebar's Tags section by default."
enable_new_user_profile_nav_groups: "EXPERIMENTAL: Users of the selected groups will be shown the new user profile navigation menu"
diff --git a/config/locales/server.es.yml b/config/locales/server.es.yml
index 51b3fd39559..7d8d2e42533 100644
--- a/config/locales/server.es.yml
+++ b/config/locales/server.es.yml
@@ -1662,8 +1662,6 @@ es:
top_topics_formula_first_post_likes_multiplier: "valor del multiplicador de me gusta en la primera publicación (n) en la fórmula de temas destacados: «log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)»"
top_topics_formula_least_likes_per_post_multiplier: "valor del multiplicador de me gusta por publicación (n) en la fórmula de temas destacados: «log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)»"
enable_safe_mode: "Permitir a los usuarios ingresar al modo seguro para depurar plugins."
- enable_experimental_sidebar_hamburger: "Permite habilitar la barra lateral experimental y el menú desplegable de hamburguesas del usuario."
- enable_sidebar: "Habilita la barra lateral experimental."
rate_limit_create_topic: "Después de crear un tema, los usuarios deben esperar (n) segundos antes de crear otro tema."
rate_limit_create_post: "Después de realizar una publicación, los usuarios deben esperar (n) segundos antes de crear otra publicación."
rate_limit_new_user_create_topic: "Después de crear un tema, los nuevos usuarios deben esperar (n) segundos antes de crear otro tema."
diff --git a/config/locales/server.fi.yml b/config/locales/server.fi.yml
index b6e99d68dcf..ace130b7e6a 100644
--- a/config/locales/server.fi.yml
+++ b/config/locales/server.fi.yml
@@ -1665,8 +1665,6 @@ fi:
top_topics_formula_first_post_likes_multiplier: "avausviestin tykkäysmäärän kerroin (n) Suositut-listauksen kaavassa: `log(katselut) * 2 + avausviestin tykkäykset * (n) + PIENEMPI(tykkäysten määrä / viestien määrä, 3) + 10 + log(viestien määrä)`"
top_topics_formula_least_likes_per_post_multiplier: "tykkäykset/viestit -suhteen enimmäisarvo (n) Suositut-listauksen kaavassa: `log(katselut) * 2 + avausviestin tykkäykset * 0.5 + PIENEMPI(tykkäysten määrä / viestien määrä, (n)) + 10 + log(viestien määrä)`"
enable_safe_mode: "Salli käyttäjän siirtyä vikasietotilaan lisäosien vianmääritystä varten."
- enable_experimental_sidebar_hamburger: "Mahdollistaa kokeellisen sivupalkin ja käyttäjän hampurilaisvalikon käyttöönoton."
- enable_sidebar: "Ottaa käyttöön kokeellisen sivupalkin."
rate_limit_create_topic: "Ketjun aloittamisen jälkeen käyttäjän täytyy odottaa (n) sekuntia ennen toisen ketjun aloittamista."
rate_limit_create_post: "Viestin luomisen jälkeen käyttäjän täytyy odottaa (n) sekuntia ennen uuden viestin luomista."
rate_limit_new_user_create_topic: "Ketjun luomisen jälkeen uuden käyttäjän täytyy odottaa (n) sekuntia ennen uuden ketjun luomista."
diff --git a/config/locales/server.fr.yml b/config/locales/server.fr.yml
index 17cf421d033..c22fa941fa0 100644
--- a/config/locales/server.fr.yml
+++ b/config/locales/server.fr.yml
@@ -1662,8 +1662,6 @@ fr:
top_topics_formula_first_post_likes_multiplier: "formule permettant d'obtenir la valeur du multiplicateur des premiers « J'aime » (n) dans les sujets tendance : « log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count) »"
top_topics_formula_least_likes_per_post_multiplier: "formule permettant d'obtenir la valeur du multiplicateur du plus petit nombre de « J'aime » par message (n) dans les sujets tendance : « log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count) »"
enable_safe_mode: "Permettre aux utilisateurs d'utiliser le mode sans échec pour déboguer les extensions."
- enable_experimental_sidebar_hamburger: "Permet d'activer la barre latérale expérimentale et le menu déroulant hamburger de l'utilisateur."
- enable_sidebar: "Active la barre latérale expérimentale."
rate_limit_create_topic: "Après la création d'un sujet, les utilisateurs doivent attendre (n) secondes avant de pouvoir en créer un nouveau."
rate_limit_create_post: "Après avoir publié un message, les utilisateurs doivent attendre (n) secondes avant de pouvoir en publier un autre."
rate_limit_new_user_create_topic: "Après la création d'un sujet, les nouveaux utilisateurs doivent attendre (n) secondes avant de pouvoir en créer un nouveau."
diff --git a/config/locales/server.he.yml b/config/locales/server.he.yml
index 8d75a06307d..370741078d1 100644
--- a/config/locales/server.he.yml
+++ b/config/locales/server.he.yml
@@ -1781,8 +1781,6 @@ he:
top_topics_formula_first_post_likes_multiplier: "מכפיל של לייקים על הפוסט הראשון (n) בנוסת הנושאים המובילים: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "מכפיל של כמות לייקים מינימלית לפוסט (n) בנוסחת הנושאים המובילים: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "לאפשר למשתמשים להיכנס למצב בטוח כדי לנפות שגיאות בתוספים."
- enable_experimental_sidebar_hamburger: "מאפשר להפעיל סרגל צד ניסיוני ותפריט המבורגר נגלל למשתמש."
- enable_sidebar: "מפעיל סרגל צד ניסיוני."
rate_limit_create_topic: "לאחר יצירת נושא, על המשתמשים להמתין (n) שניות לפני יצירת נושא אחר."
rate_limit_create_post: "לאחר הפרסום על המשתמשים להמתין (n) שניות לפני יצירת פוסט חדש."
rate_limit_new_user_create_topic: "לאחר יצירת נושא, משתמשים חדשים יחוייבו לחכות (n) שניות לפני שיוכלו ליצור נושא אחר."
diff --git a/config/locales/server.hu.yml b/config/locales/server.hu.yml
index 02956325025..d4eb8145c5f 100644
--- a/config/locales/server.hu.yml
+++ b/config/locales/server.hu.yml
@@ -962,8 +962,6 @@ hu:
min_password_length: "Minimum jelszóhossz."
block_common_passwords: "A 10 000 leggyakoribb jelszó tiltása."
discord_secret: "Discord titkos kulcs"
- enable_experimental_sidebar_hamburger: "Lehetővé teszi a kísérleti oldalsáv és a felhasználói hamburger legördülő menü engedélyezését."
- enable_sidebar: "Engedélyezi a kísérleti oldalsávot."
rate_limit_new_user_create_topic: "Egy téma létrehozása után az új felhasználóknak (n) másodpercet kell várniuk, mielőtt új témát hozhatnak létre."
suggested_topics: "A javasolt témák száma a téma alján láthatók."
limit_suggested_to_category: "Csak a javasolt kategóriákból származó témakörök jelenhetnek meg a javasolt témakörökben."
diff --git a/config/locales/server.it.yml b/config/locales/server.it.yml
index d7563c42a8c..01b2c8130b0 100644
--- a/config/locales/server.it.yml
+++ b/config/locales/server.it.yml
@@ -1662,8 +1662,6 @@ it:
top_topics_formula_first_post_likes_multiplier: "valore del moltiplicatore (n) dei mi piace sul primo messaggio nella formula dei migliori argomenti: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "valore del moltiplicatore (n) del numero minimo di \"mi piace\" per messaggio nella formula dei migliori argomenti: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Consenti agli utenti di accedere alla modalità sicura per eseguire il debug dei plug-in."
- enable_experimental_sidebar_hamburger: "Consente di abilitare in via sperimentale la barra laterale e il menu utente a tendina."
- enable_sidebar: "Abilita la barra laterale sperimentale."
rate_limit_create_topic: "Dopo aver creato un argomento, gli utenti devono aspettare (n) secondi prima di poterne creare un altro."
rate_limit_create_post: "Dopo aver inviato un messaggio, gli utenti devono aspettare (n) secondi prima di creare un altro messaggio. "
rate_limit_new_user_create_topic: "Dopo aver creato un argomento, i nuovi utenti devono aspettare (n) secondi prima di poter creare un altro argomento."
diff --git a/config/locales/server.ja.yml b/config/locales/server.ja.yml
index 183f6b78734..d6e1b58bad5 100644
--- a/config/locales/server.ja.yml
+++ b/config/locales/server.ja.yml
@@ -1613,8 +1613,6 @@ ja:
top_topics_formula_first_post_likes_multiplier: "人気のトピックの計算式に使用する最初の投稿の「いいね!」の乗数 (n) の値: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "人気のトピックの計算式に使用する最小「いいね!」率の乗数 (n) の値: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "プラグインをデバッグするためにユーザーによる安全モードの開始を許可する。"
- enable_experimental_sidebar_hamburger: "実験的サイドバーとユーザーのハンバーガードロップダウンメニューを有効にできます。"
- enable_sidebar: "実験的サイドバーを有効にします。"
rate_limit_create_topic: "トピック作成後、ユーザーは (n) 秒待ってから次のトピックを作成する必要があります。"
rate_limit_create_post: "投稿後、ユーザーは (n) 秒待ってから次の投稿を作成する必要があります。"
rate_limit_new_user_create_topic: "トピック作成後、新規ユーザーは (n) 秒待ってから次のトピックを作成する必要があります。"
diff --git a/config/locales/server.nl.yml b/config/locales/server.nl.yml
index cae283e725a..16f3ee5eece 100644
--- a/config/locales/server.nl.yml
+++ b/config/locales/server.nl.yml
@@ -1676,8 +1676,6 @@ nl:
top_topics_formula_first_post_likes_multiplier: "waarde van vermenigvuldiger (n) voor likes van eerste berichten in toptopicsformule: 'log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)'"
top_topics_formula_least_likes_per_post_multiplier: "waarde van vermenigvuldiger (n) voor minste likes per bericht in toptopicsformule: 'log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)'"
enable_safe_mode: "Gebruikers mogen de veilige modus betreden om plug-ins te debuggen."
- enable_experimental_sidebar_hamburger: "Staat toe dat de experimentele zijbalk en het hamburgermenu van de gebruiker worden ingeschakeld."
- enable_sidebar: "Schakelt de experimentele zijbalk in."
rate_limit_create_topic: "Na het maken van een topic moeten gebruikers (n) seconden wachten voordat ze een ander topic kunnen maken."
rate_limit_create_post: "Na het plaatsen van een bericht moeten gebruikers (n) seconden wachten voor ze een ander bericht kunnen plaatsen."
rate_limit_new_user_create_topic: "Na het maken van een topic moeten nieuwe gebruikers (n) seconden wachten voor ze een ander topic kunnen maken."
diff --git a/config/locales/server.pl_PL.yml b/config/locales/server.pl_PL.yml
index 970102d0171..6e0f881fe5d 100644
--- a/config/locales/server.pl_PL.yml
+++ b/config/locales/server.pl_PL.yml
@@ -1761,8 +1761,6 @@ pl_PL:
top_topics_formula_first_post_likes_multiplier: "wartość mnożnika polubień pierwszego wpisu (n) w tematach formuła: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "wartość mnożnika najmniejszej liczby polubień na wpis w (n) tematach formuła: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Zezwól użytkownikom na wchodzenie do trybu awaryjnego w celu debudowania wtyczek."
- enable_experimental_sidebar_hamburger: "Umożliwia włączenie eksperymentalnego paska bocznego i rozwijanego hamburger menu użytkownika."
- enable_sidebar: "Włącza eksperymentalny pasek boczny."
rate_limit_create_topic: "Po otworzeniu tematu użytkownicy muszą odczekać (n) sekund, zanim otworzą inny temat."
rate_limit_create_post: "Po napisaniu wpisu użytkownicy muszą odczekać (n) sekund, zanim napiszą inny wpis."
rate_limit_new_user_create_topic: "Po otworzeniu tematu nowi użytkownicy muszą odczekać (n) sekund, zanim otworzą inny temat."
diff --git a/config/locales/server.pt_BR.yml b/config/locales/server.pt_BR.yml
index 1f1b7c1b9e8..5fca02ba160 100644
--- a/config/locales/server.pt_BR.yml
+++ b/config/locales/server.pt_BR.yml
@@ -1665,8 +1665,6 @@ pt_BR:
top_topics_formula_first_post_likes_multiplier: "valor do multiplicador de curtidas da primeira postagem (n) na fórmula dos melhores tópicos: \"log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)\""
top_topics_formula_least_likes_per_post_multiplier: "valor do multiplicador da menor quantidade de curtidas por publicação (n) na fórmula de melhores tópicos: \"log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)\""
enable_safe_mode: "Permitir que os(as) usuários(as) insiram o modo de segurança para depurar plug-ins."
- enable_experimental_sidebar_hamburger: "Permite que a barra lateral experimental e o menu hambúrguer suspenso do usuário sejam ativados."
- enable_sidebar: "Ativar barra lateral experimental."
rate_limit_create_topic: "Após criar um tópico, os(as) usuários(as) devem aguardar (n) segundos antes de criar um outro tópico."
rate_limit_create_post: "Após postar, os(as) usuários(as) devem aguardar (n) segundos antes de criar outra postagem."
rate_limit_new_user_create_topic: "Após criar um tópico, novos(as) usuários(as) devem aguardar (n) segundos antes de criar outro tópico."
diff --git a/config/locales/server.ru.yml b/config/locales/server.ru.yml
index 4d9361edf51..b5879512ea9 100644
--- a/config/locales/server.ru.yml
+++ b/config/locales/server.ru.yml
@@ -1761,8 +1761,6 @@ ru:
top_topics_formula_first_post_likes_multiplier: "значение первого поста множитель лайков (n) в формуле топ-тем: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "значение наименьшего количества лайков на множитель поста (n) в формуле топ-тем: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Разрешать пользователям входить в безопасный режим для отладки плагинов."
- enable_experimental_sidebar_hamburger: "Позволяет включить экспериментальную боковую панель и раскрывающееся меню пользователя."
- enable_sidebar: "Включить экспериментальную боковую панель."
rate_limit_create_topic: "Пользователи могут создавать новую тему после создания предыдущей только по прошествии указанного здесь количества секунд."
rate_limit_create_post: "Пользователи могут создавать новое сообщение после создания предыдущего только по прошествии указанного здесь количества секунд."
rate_limit_new_user_create_topic: "Новички могут создавать новую тему после создания предыдущей только по прошествии указанного здесь количества секунд."
diff --git a/config/locales/server.sv.yml b/config/locales/server.sv.yml
index a4cb3d03cc4..dcc62df3102 100644
--- a/config/locales/server.sv.yml
+++ b/config/locales/server.sv.yml
@@ -1677,8 +1677,6 @@ sv:
top_topics_formula_first_post_likes_multiplier: "värde av första inläggsgillningsmultiplikatorn (n) i formeln för toppämnen: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "värde av minsta inläggsgillningsmultiplikatorn (n) i formeln för toppämnen: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Tillåt användare att gå in i säkert läge för att felsöka tillägg."
- enable_experimental_sidebar_hamburger: "Tillåter att experimentellt sidofält och användarens hamburgarmeny aktiveras."
- enable_sidebar: "Aktiverar experimentellt sidofält."
rate_limit_create_topic: "Efter att ha skapat ett ämne, måste användare vänta (n) sekunder innan de kan skapa ett nytt."
rate_limit_create_post: "Efter att ha skrivit ett inlägg, måste användare vänta (n) sekunder innan de skriver ett nytt."
rate_limit_new_user_create_topic: "Efter att ha skapat ett ämne, måste nya användare vänta (n) sekunder innan de kan skapa ett nytt."
diff --git a/config/locales/server.tr_TR.yml b/config/locales/server.tr_TR.yml
index d56b2249077..ad2ffe4366a 100644
--- a/config/locales/server.tr_TR.yml
+++ b/config/locales/server.tr_TR.yml
@@ -1669,8 +1669,6 @@ tr_TR:
top_topics_formula_first_post_likes_multiplier: "en popüler konular formülünde ilk gönderi beğeni çarpanının (n) değeri: \"log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)\""
top_topics_formula_least_likes_per_post_multiplier: "en popüler konular formülünde gönderi başına en az beğeni çarpanı (n) değeri: \"log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)\""
enable_safe_mode: "Kullanıcıların eklentilerde hata ayıklamak için güvenli moda girmesine izin verin."
- enable_experimental_sidebar_hamburger: "Deneysel kenar çubuğunun ve kullanıcı hamburger açılır menüsünün etkinleştirilmesini sağlar."
- enable_sidebar: "Deneysel kenar çubuğunu etkinleştirir."
rate_limit_create_topic: "Bir konu oluşturduktan sonra, kullanıcılar başka bir konu oluşturabilmek için (n) saniye beklemelidir."
rate_limit_create_post: "Gönderi yaptıktan sonra, kullanıcılar başka bir gönderi oluşturabilmek için (n) saniye beklemelidir."
rate_limit_new_user_create_topic: "Bir konu oluşturduktan sonra, yeni kullanıcılar başka bir konu oluşturabilmek için (n) saniye beklemelidir."
diff --git a/config/locales/server.uk.yml b/config/locales/server.uk.yml
index 8da54a852c5..83118c29340 100644
--- a/config/locales/server.uk.yml
+++ b/config/locales/server.uk.yml
@@ -1773,8 +1773,6 @@ uk:
top_topics_formula_first_post_likes_multiplier: "значення коефіцієнта множення переглядів журналу (n) у формулі топ-тем: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "значення коефіцієнта найменшої кількості вподобань на допис (n) у формулі топ-тем: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "Дозволити користувачам входити в безпечний режим для налагодження плагінів."
- enable_experimental_sidebar_hamburger: "Дозволяє вмикати експериментальну бічну панель і спадне меню користувача."
- enable_sidebar: "Вмикає експериментальну бічну панель."
rate_limit_create_topic: "Після створення теми користувачі повинні зачекати (n) секунд, перш ніж створювати іншу тему."
rate_limit_create_post: "Після надсилання користувачі повинні зачекати (n) секунд, перш ніж створити інший допис."
rate_limit_new_user_create_topic: "Після створення теми нові користувачі повинні зачекати (n) секунд, перш ніж створювати нову тему."
diff --git a/config/locales/server.vi.yml b/config/locales/server.vi.yml
index 9fc30c0537b..eb712846fe2 100644
--- a/config/locales/server.vi.yml
+++ b/config/locales/server.vi.yml
@@ -1156,8 +1156,6 @@ vi:
top_topics_formula_log_views_multiplier: "giá trị nhật ký lượt xem nhân với (n) trong công thức chủ đề top: `log(views_count) * (n) + op_likes_count * 0.5 + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_first_post_likes_multiplier: "giá trị của lượt like bài viết đầu tiên nhân với (n) trong công thức chủ đề top: `log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "giá trị số lượt like tối thiểu của mỗi bài viết nhân với (n) trong công thức chủ đề top: `log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
- enable_experimental_sidebar_hamburger: "Cho phép bật thanh bên thử nghiệm và menu thả xuống hamburger người dùng."
- enable_sidebar: "Bật thanh bên thử nghiệm."
rate_limit_create_topic: "Sau khi tạo một chủ đề, người dùng phải chờ (n) giây trước khi tạo một chủ đề khác."
rate_limit_create_post: "Sau khi đăn bài, người dùng phải chờ (n) giây trước khi đăng bài khác."
rate_limit_new_user_create_topic: "Sau khi tạo một chủ đề, người dùng mới phải chờ (n) giây trước khi tạo chủ đề khác."
diff --git a/config/locales/server.zh_CN.yml b/config/locales/server.zh_CN.yml
index d2d4a41be6c..34302c6961b 100644
--- a/config/locales/server.zh_CN.yml
+++ b/config/locales/server.zh_CN.yml
@@ -1613,8 +1613,6 @@ zh_CN:
top_topics_formula_first_post_likes_multiplier: "热门话题中第一个帖子点赞因子 (n) 值的公式:`log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "热门话题中每个帖子的最少点赞因子 (n) 值的公式:`log(views_count) * 2 + op_likes_count * 0.5 + LEAST(likes_count / posts_count, (n)) + 10 + log(posts_count)`"
enable_safe_mode: "允许用户进入安全模式以调试插件。"
- enable_experimental_sidebar_hamburger: "允许启用实验性边栏和用户汉堡下拉菜单。"
- enable_sidebar: "启用实验性边栏。"
rate_limit_create_topic: "创建话题后,用户必须等待 (n) 秒才能创建另一个话题。"
rate_limit_create_post: "发帖后,用户必须等待 (n) 秒才能创建另一个帖子。"
rate_limit_new_user_create_topic: "创建话题后,新用户必须等待 (n) 秒才能创建另一个话题。"
diff --git a/config/locales/server.zh_TW.yml b/config/locales/server.zh_TW.yml
index 83d49a9fd80..9134b7bd030 100644
--- a/config/locales/server.zh_TW.yml
+++ b/config/locales/server.zh_TW.yml
@@ -1247,8 +1247,6 @@ zh_TW:
top_topics_formula_first_post_likes_multiplier: "熱門主題公式中首貼讚的數量的因子的值(n):`log(views_count) * 2 + op_likes_count * (n) + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
top_topics_formula_least_likes_per_post_multiplier: "熱門主題公式中贊和貼文數量的比例的最小值(n):`log(views_count) * (n) + op_likes_count * 0.5 + LEAST(likes_count / posts_count, 3) + 10 + log(posts_count)`"
enable_safe_mode: "允許使用者進入安全模式以偵錯插件(plugins)。"
- enable_experimental_sidebar_hamburger: "允許啟用實驗側選單和漢堡下拉選單。"
- enable_sidebar: "啟用實驗性側選單。"
rate_limit_create_topic: "建立新討論話題之後,使用者必須間隔多少秒 (n) 才能再建立新討論話題"
rate_limit_create_post: "建立新貼文之後,使用者必須間隔多少秒 (n) 才能再建立新貼文"
rate_limit_new_user_create_topic: "建立一個話題後,新使用者必須等待 (n) 秒才能建立另一個新話題"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 972533460db..030192af47c 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -2032,9 +2032,6 @@ developer:
enable_safe_mode:
default: true
client: true
- enable_experimental_sidebar_hamburger:
- default: false
- client: true
enable_experimental_hashtag_autocomplete:
default: false
client: true
@@ -2060,10 +2057,12 @@ developer:
allow_any: false
refresh: true
-sidebar:
- enable_sidebar:
- default: true
+navigation:
+ navigation_menu:
client: true
+ default: "legacy"
+ type: enum
+ enum: "NavigationMenuSiteSetting"
default_sidebar_categories:
type: category_list
default: ""
diff --git a/db/migrate/20221205225450_migrate_sidebar_site_settings.rb b/db/migrate/20221205225450_migrate_sidebar_site_settings.rb
new file mode 100644
index 00000000000..fc6a054f4d4
--- /dev/null
+++ b/db/migrate/20221205225450_migrate_sidebar_site_settings.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+class MigrateSidebarSiteSettings < ActiveRecord::Migration[7.0]
+ def up
+ previous_enable_experimental_sidebar_hamburger = DB.query_single(
+ "SELECT value FROM site_settings WHERE name = 'enable_experimental_sidebar_hamburger'"
+ )[0]
+
+ previous_enable_sidebar = DB.query_single(
+ "SELECT value FROM site_settings WHERE name = 'enable_sidebar'"
+ )[0]
+
+ value =
+ case [previous_enable_experimental_sidebar_hamburger, previous_enable_sidebar]
+ when ['t', 't'], ['t', nil]
+ "sidebar"
+ when ['t', 'f']
+ "header dropdown"
+ when ['f', 't'], ['f', 'f'], ['f', nil]
+ "legacy"
+ when [nil, 't'], [nil, 'f'], [nil, nil]
+ nil
+ end
+
+ if value
+ execute(<<~SQL)
+ INSERT INTO site_settings (name, data_type, value, created_at, updated_at)
+ VALUES ('navigation_menu', 8, '#{value}', now(), now())
+ SQL
+ end
+ end
+
+ def down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb
index 4c215de835c..2925cc0760b 100644
--- a/lib/site_setting_extension.rb
+++ b/lib/site_setting_extension.rb
@@ -235,13 +235,7 @@ module SiteSettingExtension
defaults.all(default_locale)
.reject do |setting_name, _|
- if !include_hidden && hidden_settings.include?(setting_name)
- true
- elsif categories[setting_name].to_s == "sidebar" && !SiteSetting.enable_experimental_sidebar_hamburger
- true
- else
- false
- end
+ !include_hidden && hidden_settings.include?(setting_name)
end.map do |s, v|
type_hash = type_supervisor.type_hash(s)
default = defaults.get(s, default_locale).to_s
diff --git a/plugins/chat/assets/javascripts/discourse/controllers/chat.js b/plugins/chat/assets/javascripts/discourse/controllers/chat.js
index ea70452f449..1ea1e5a478a 100644
--- a/plugins/chat/assets/javascripts/discourse/controllers/chat.js
+++ b/plugins/chat/assets/javascripts/discourse/controllers/chat.js
@@ -17,9 +17,6 @@ export default class ChatController extends Controller {
}
get shouldUseCoreSidebar() {
- return (
- this.siteSettings.enable_sidebar &&
- this.siteSettings.enable_experimental_sidebar_hamburger
- );
+ return this.siteSettings.navigation_menu === "sidebar";
}
}
diff --git a/plugins/chat/spec/system/navigation_spec.rb b/plugins/chat/spec/system/navigation_spec.rb
index 0e69f4f5845..8744f6b5849 100644
--- a/plugins/chat/spec/system/navigation_spec.rb
+++ b/plugins/chat/spec/system/navigation_spec.rb
@@ -151,10 +151,9 @@ RSpec.describe "Navigation", type: :system, js: true do
end
end
- context "when sidebar is enabled" do
+ context "when sidebar is configured as the navigation menu" do
before do
- SiteSetting.enable_experimental_sidebar_hamburger = true
- SiteSetting.enable_sidebar = true
+ SiteSetting.navigation_menu = "sidebar"
end
context "when opening channel from sidebar with drawer preferred" do
diff --git a/plugins/chat/spec/system/receiving_message_spec.rb b/plugins/chat/spec/system/receiving_message_spec.rb
index 5c89289667f..96b412e0dd7 100644
--- a/plugins/chat/spec/system/receiving_message_spec.rb
+++ b/plugins/chat/spec/system/receiving_message_spec.rb
@@ -20,8 +20,7 @@ RSpec.describe "Receiving message", type: :system, js: true do
context "when core sidebar is enabled" do
before do
- SiteSetting.enable_sidebar = true
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
end
context "when receiving a direct message" do
diff --git a/plugins/chat/spec/system/sidebars_spec.rb b/plugins/chat/spec/system/sidebars_spec.rb
index 64cd8f8df0f..cfded835d08 100644
--- a/plugins/chat/spec/system/sidebars_spec.rb
+++ b/plugins/chat/spec/system/sidebars_spec.rb
@@ -14,10 +14,9 @@ RSpec.describe "Navigation", type: :system, js: true do
sign_in(user)
end
- context "when core sidebar is enabled" do
+ context "when sidebar is enabled as the navigation menu" do
before do
- SiteSetting.enable_sidebar = true
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
end
it "uses core sidebar" do
diff --git a/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js b/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js
index 51f664b3c54..2d3790a6baf 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-channels-list-test.js
@@ -15,8 +15,7 @@ acceptance(
needs.settings({
chat_enabled: true,
- enable_sidebar: false,
- enable_experimental_sidebar_hamburger: false,
+ navigation_menu: "legacy",
});
needs.pretender((server, helper) => {
diff --git a/plugins/chat/test/javascripts/acceptance/chat-sidebar-user-status-test.js b/plugins/chat/test/javascripts/acceptance/chat-sidebar-user-status-test.js
index 25d45bf18d4..698b6a9cda8 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-sidebar-user-status-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-sidebar-user-status-test.js
@@ -15,8 +15,7 @@ acceptance("Discourse Chat - Sidebar - User Status", function (needs) {
needs.settings({
chat_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.pretender((server, helper) => {
diff --git a/plugins/chat/test/javascripts/acceptance/chat-status-test.js b/plugins/chat/test/javascripts/acceptance/chat-status-test.js
index a4cd51a825d..31df31bebdf 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-status-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-status-test.js
@@ -61,7 +61,6 @@ acceptance(
needs.settings({
chat_enabled: true,
chat_allow_archiving_channels: true,
- enable_sidebar: false,
});
needs.pretender((server, helper) => {
diff --git a/plugins/chat/test/javascripts/acceptance/chat-test.js b/plugins/chat/test/javascripts/acceptance/chat-test.js
index 3f41e506e6d..39781e15347 100644
--- a/plugins/chat/test/javascripts/acceptance/chat-test.js
+++ b/plugins/chat/test/javascripts/acceptance/chat-test.js
@@ -65,7 +65,7 @@ acceptance("Discourse Chat - without unread", function (needs) {
has_chat_enabled: true,
});
needs.settings({
- enable_sidebar: false,
+ navigation_menu: "legacy",
chat_enabled: true,
});
needs.pretender((server, helper) => {
diff --git a/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js b/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js
index fe3968b5c95..52d303dc2f3 100644
--- a/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js
+++ b/plugins/chat/test/javascripts/acceptance/core-sidebar-test.js
@@ -18,8 +18,7 @@ acceptance("Discourse Chat - Core Sidebar", function (needs) {
needs.settings({
chat_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.pretender((server, helper) => {
@@ -528,7 +527,7 @@ acceptance("Discourse Chat - Plugin Sidebar", function (needs) {
needs.settings({
chat_enabled: true,
- enable_sidebar: false,
+ navigation_menu: "legacy",
});
needs.pretender((server, helper) => {
@@ -613,8 +612,7 @@ acceptance(
needs.settings({
chat_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.pretender((server, helper) => {
@@ -656,8 +654,7 @@ acceptance(
needs.settings({
chat_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
});
needs.pretender((server, helper) => {
@@ -698,8 +695,7 @@ acceptance(
needs.settings({
chat_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
direct_message_enabled_groups: "13", // trust_level_3 auto group ID;
});
@@ -741,8 +737,7 @@ acceptance(
needs.settings({
chat_enabled: true,
- enable_experimental_sidebar_hamburger: true,
- enable_sidebar: true,
+ navigation_menu: "sidebar",
direct_message_enabled_groups: "13", // trust_level_3 auto group ID;
});
diff --git a/spec/jobs/notify_reviewable_spec.rb b/spec/jobs/notify_reviewable_spec.rb
index dd88982f406..3e0864a5707 100644
--- a/spec/jobs/notify_reviewable_spec.rb
+++ b/spec/jobs/notify_reviewable_spec.rb
@@ -11,7 +11,7 @@ RSpec.describe Jobs::NotifyReviewable do
fab!(:user) { group_user.user }
it "will notify users of new reviewable content for the new user menu" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.enable_category_group_moderation = true
GroupUser.create!(group_id: group.id, user_id: moderator.id)
@@ -84,7 +84,7 @@ RSpec.describe Jobs::NotifyReviewable do
end
it "will notify users of new reviewable content for the old user menu" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ SiteSetting.navigation_menu = "legacy"
SiteSetting.enable_category_group_moderation = true
GroupUser.create!(group_id: group.id, user_id: moderator.id)
diff --git a/spec/lib/site_setting_extension_spec.rb b/spec/lib/site_setting_extension_spec.rb
index bf5fd92b389..4cd1905f9f3 100644
--- a/spec/lib/site_setting_extension_spec.rb
+++ b/spec/lib/site_setting_extension_spec.rb
@@ -833,24 +833,4 @@ RSpec.describe SiteSettingExtension do
end
end
end
-
- describe 'sidebar category site settings' do
- describe '.all_settings' do
- before do
- settings.setting(:test_setting, 88, category: :sidebar)
- end
-
- it 'does not include the sidebar category setting when enable_experimental_sidebar_hamburger site setting is disabled' do
- SiteSetting.enable_experimental_sidebar_hamburger = false
-
- expect(settings.all_settings.detect { |s| s[:setting] == :test_setting }).to eq(nil)
- end
-
- it 'includes the sidebar category setting when enable_experimental_sidebar_hamburger site setting is enabled' do
- SiteSetting.enable_experimental_sidebar_hamburger = true
-
- expect(settings.all_settings.detect { |s| s[:setting] == :test_setting }[:setting]).to eq(:test_setting)
- end
- end
- end
end
diff --git a/spec/models/topic_tracking_state_spec.rb b/spec/models/topic_tracking_state_spec.rb
index 3ddabfabeb1..d382f8f2a35 100644
--- a/spec/models/topic_tracking_state_spec.rb
+++ b/spec/models/topic_tracking_state_spec.rb
@@ -593,13 +593,13 @@ RSpec.describe TopicTrackingState do
)
end
- it "includes tags when SiteSetting.enable_experimental_sidebar_hamburger is true" do
+ it "includes tags when SiteSetting.navigation_menu is not legacy" do
report = TopicTrackingState.report(user)
expect(report.length).to eq(1)
row = report[0]
expect(row.respond_to?(:tags)).to eq(false)
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
report = TopicTrackingState.report(user)
expect(report.length).to eq(1)
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index b7276d5caa0..f201ceb4c9f 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe User do
fab!(:staff_tag_group) { Fabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name]) }
before do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = true
SiteSetting.default_sidebar_categories = "#{category.id}|#{secured_category.id}"
SiteSetting.default_sidebar_tags = "#{tag.name}|#{hidden_tag.name}"
@@ -107,8 +107,8 @@ RSpec.describe User do
expect(SidebarSectionLink.where(linkable_type: 'Category', user_id: user.id).pluck(:linkable_id)).to be_empty
end
- it 'should not create any sidebar section link records when experimental sidebar is disabled' do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it 'should not create any sidebar section link records when navigation_menu site setting is still legacy' do
+ SiteSetting.navigation_menu = "legacy"
user = Fabricate(:user)
@@ -2195,9 +2195,9 @@ RSpec.describe User do
expect(message).to eq(nil)
end
- context "with redesigned_user_menu_enabled on" do
+ context "with sidebar based navigation menu" do
before do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
end
it "adds all_unread_notifications and grouped_unread_notifications to the payload" do
diff --git a/spec/requests/notifications_controller_spec.rb b/spec/requests/notifications_controller_spec.rb
index 52fb28094bb..da2f29b5846 100644
--- a/spec/requests/notifications_controller_spec.rb
+++ b/spec/requests/notifications_controller_spec.rb
@@ -111,7 +111,7 @@ RSpec.describe NotificationsController do
expect(JSON.parse(response.body)['notifications'][0]['read']).to eq(false)
end
- context "with the enable_experimental_sidebar_hamburger setting" do
+ context "when navigation menu settings is non-legacy" do
fab!(:unread_high_priority) do
Fabricate(
:notification,
@@ -121,6 +121,7 @@ RSpec.describe NotificationsController do
created_at: 10.minutes.ago
)
end
+
fab!(:read_high_priority) do
Fabricate(
:notification,
@@ -130,6 +131,7 @@ RSpec.describe NotificationsController do
created_at: 8.minutes.ago
)
end
+
fab!(:unread_regular) do
Fabricate(
:notification,
@@ -139,6 +141,7 @@ RSpec.describe NotificationsController do
created_at: 6.minutes.ago
)
end
+
fab!(:read_regular) do
Fabricate(
:notification,
@@ -148,12 +151,18 @@ RSpec.describe NotificationsController do
created_at: 4.minutes.ago
)
end
+
fab!(:pending_reviewable) { Fabricate(:reviewable) }
- it "gets notifications list with unread ones at the top when the setting is enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ before do
+ SiteSetting.navigation_menu = "sidebar"
+ end
+
+ it "gets notifications list with unread ones at the top" do
get "/notifications.json", params: { recent: true }
+
expect(response.status).to eq(200)
+
expect(response.parsed_body["notifications"].map { |n| n["id"] }).to eq([
unread_high_priority.id,
notification.id,
@@ -163,10 +172,13 @@ RSpec.describe NotificationsController do
])
end
- it "gets notifications list with unread high priority notifications at the top when the setting is disabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it "gets notifications list with unread high priority notifications at the top when navigation menu is legacy" do
+ SiteSetting.navigation_menu = "legacy"
+
get "/notifications.json", params: { recent: true }
+
expect(response.status).to eq(200)
+
expect(response.parsed_body["notifications"].map { |n| n["id"] }).to eq([
unread_high_priority.id,
notification.id,
@@ -177,9 +189,10 @@ RSpec.describe NotificationsController do
end
it "should not bump last seen reviewable in readonly mode" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: true)
+
Discourse.received_redis_readonly!
+
expect {
get "/notifications.json", params: { recent: true, bump_last_seen_reviewable: true }
expect(response.status).to eq(200)
@@ -189,7 +202,6 @@ RSpec.describe NotificationsController do
end
it "should not bump last seen reviewable if the user can't see reviewables" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
expect {
get "/notifications.json", params: { recent: true, bump_last_seen_reviewable: true }
expect(response.status).to eq(200)
@@ -197,8 +209,8 @@ RSpec.describe NotificationsController do
end
it "should not bump last seen reviewable if the silent param is present" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: true)
+
expect {
get "/notifications.json", params: {
recent: true,
@@ -210,8 +222,8 @@ RSpec.describe NotificationsController do
end
it "should not bump last seen reviewable if the bump_last_seen_reviewable param is not present" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: true)
+
expect {
get "/notifications.json", params: { recent: true }
expect(response.status).to eq(200)
@@ -219,26 +231,33 @@ RSpec.describe NotificationsController do
end
it "bumps last_seen_reviewable_id" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: true)
+
expect(user.last_seen_reviewable_id).to eq(nil)
+
get "/notifications.json", params: { recent: true, bump_last_seen_reviewable: true }
+
+ expect(response.status).to eq(200)
expect(user.reload.last_seen_reviewable_id).to eq(pending_reviewable.id)
reviewable2 = Fabricate(:reviewable)
+
get "/notifications.json", params: { recent: true, bump_last_seen_reviewable: true }
+
+ expect(response.status).to eq(200)
expect(user.reload.last_seen_reviewable_id).to eq(reviewable2.id)
end
it "includes pending reviewables when the setting is enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: true)
pending_reviewable2 = Fabricate(:reviewable, created_at: 4.minutes.ago)
Fabricate(:reviewable, status: Reviewable.statuses[:approved])
Fabricate(:reviewable, status: Reviewable.statuses[:rejected])
get "/notifications.json", params: { recent: true }
+
expect(response.status).to eq(200)
+
expect(response.parsed_body["pending_reviewables"].map { |r| r["id"] }).to eq([
pending_reviewable.id,
pending_reviewable2.id
@@ -246,7 +265,6 @@ RSpec.describe NotificationsController do
end
it "doesn't include reviewables that are claimed by someone that's not the current user" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: true)
claimed_by_user = Fabricate(:reviewable, topic: Fabricate(:topic), created_at: 5.minutes.ago)
@@ -267,17 +285,17 @@ RSpec.describe NotificationsController do
])
end
- it "doesn't include reviewables when the setting is disabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it "doesn't include reviewables when navigation menu is legacy" do
+ SiteSetting.navigation_menu = "legacy"
user.update!(admin: true)
get "/notifications.json", params: { recent: true }
+
expect(response.status).to eq(200)
expect(response.parsed_body.key?("pending_reviewables")).to eq(false)
end
it "doesn't include reviewables if the user can't see the review queue" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
user.update!(admin: false)
get "/notifications.json", params: { recent: true }
@@ -379,12 +397,14 @@ RSpec.describe NotificationsController do
context "with 'recent' filter" do
it "doesn't include notifications from topics the user isn't allowed to see" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
+
get "/notifications.json", params: { recent: true }
expect(response.status).to eq(200)
expect_correct_notifications(response)
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ SiteSetting.navigation_menu = "legacy"
+
get "/notifications.json", params: { recent: true }
expect(response.status).to eq(200)
expect_correct_notifications(response)
@@ -393,12 +413,14 @@ RSpec.describe NotificationsController do
context "without 'recent' filter" do
it "doesn't include notifications from topics the user isn't allowed to see" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
+
get "/notifications.json"
expect(response.status).to eq(200)
expect_correct_notifications(response)
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ SiteSetting.navigation_menu = "legacy"
+
get "/notifications.json"
expect(response.status).to eq(200)
expect_correct_notifications(response)
diff --git a/spec/requests/reviewable_claimed_topics_controller_spec.rb b/spec/requests/reviewable_claimed_topics_controller_spec.rb
index 7a67291aae9..24bb5d1c66d 100644
--- a/spec/requests/reviewable_claimed_topics_controller_spec.rb
+++ b/spec/requests/reviewable_claimed_topics_controller_spec.rb
@@ -85,7 +85,7 @@ RSpec.describe ReviewableClaimedTopicsController do
end
it "queues a sidekiq job to refresh reviewable counts for users who can see the reviewable" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.enable_category_group_moderation = true
not_notified = Fabricate(:user)
@@ -159,7 +159,7 @@ RSpec.describe ReviewableClaimedTopicsController do
it "queues a sidekiq job to refresh reviewable counts for users who can see the reviewable" do
SiteSetting.reviewable_claiming = 'optional'
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.enable_category_group_moderation = true
not_notified = Fabricate(:user)
diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb
index 267bb80ce10..3f6014298cc 100644
--- a/spec/requests/users_controller_spec.rb
+++ b/spec/requests/users_controller_spec.rb
@@ -2308,9 +2308,9 @@ RSpec.describe UsersController do
expect(json['user']['id']).to eq user.id
end
- context 'with experimental sidebar' do
+ context 'with sidebar' do
before do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
end
it 'does not remove category or tag sidebar section links when params are not present' do
diff --git a/spec/serializers/current_user_serializer_spec.rb b/spec/serializers/current_user_serializer_spec.rb
index 8f948a1e50d..aec2d373320 100644
--- a/spec/serializers/current_user_serializer_spec.rb
+++ b/spec/serializers/current_user_serializer_spec.rb
@@ -229,8 +229,8 @@ RSpec.describe CurrentUserSerializer do
fab!(:tag_sidebar_section_link_2) { Fabricate(:tag_sidebar_section_link, user: user, linkable: pm_tag) }
fab!(:tag_sidebar_section_link_3) { Fabricate(:tag_sidebar_section_link, user: user, linkable: hidden_tag) }
- it "is not included when experimental sidebar has not been enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it "is not included when navigation menu is legacy" do
+ SiteSetting.navigation_menu = "legacy"
SiteSetting.tagging_enabled = true
json = serializer.as_json
@@ -239,7 +239,7 @@ RSpec.describe CurrentUserSerializer do
end
it "is not included when tagging has not been enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = false
json = serializer.as_json
@@ -247,8 +247,8 @@ RSpec.describe CurrentUserSerializer do
expect(json[:sidebar_tags]).to eq(nil)
end
- it "serializes only the tags that the user can see when experimental sidebar and tagging has been enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ it "serializes only the tags that the user can see when sidebar and tagging has been enabled" do
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = true
json = serializer.as_json
@@ -279,25 +279,17 @@ RSpec.describe CurrentUserSerializer do
fab!(:category_sidebar_section_link_2) { Fabricate(:category_sidebar_section_link, user: user, linkable: category_2) }
fab!(:category_sidebar_section_link_3) { Fabricate(:category_sidebar_section_link, user: user, linkable: private_category) }
- it "is not included when SiteSetting.enable_experimental_sidebar_hamburger is false" do
+ it "is not included when navigation menu is legacy" do
category_sidebar_section_link
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ SiteSetting.navigation_menu = "legacy"
json = serializer.as_json
expect(json[:sidebar_category_ids]).to eq(nil)
end
- it "is not included when experimental sidebar has not been enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
-
- json = serializer.as_json
-
- expect(json[:sidebar_category_ids]).to eq(nil)
- end
-
- it 'serializes only the categories that the user can see when experimental sidebar and tagging has been enabled"' do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ it 'serializes only the categories that the user can see when sidebar and tagging has been enabled"' do
+ SiteSetting.navigation_menu = "sidebar"
json = serializer.as_json
@@ -383,13 +375,15 @@ RSpec.describe CurrentUserSerializer do
describe "#new_personal_messages_notifications_count" do
fab!(:notification) { Fabricate(:notification, user: user, read: false, notification_type: Notification.types[:private_message]) }
- it "isn't included when enable_experimental_sidebar_hamburger is disabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it "isn't included when navigation menu is legacy" do
+ SiteSetting.navigation_menu = "legacy"
+
expect(serializer.as_json[:new_personal_messages_notifications_count]).to be_nil
end
- it "is included when enable_experimental_sidebar_hamburger is enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ it "is included when sidebar is enabled" do
+ SiteSetting.navigation_menu = "sidebar"
+
expect(serializer.as_json[:new_personal_messages_notifications_count]).to eq(1)
end
end
diff --git a/spec/serializers/site_serializer_spec.rb b/spec/serializers/site_serializer_spec.rb
index 0b5e2457fa1..eb8635b977c 100644
--- a/spec/serializers/site_serializer_spec.rb
+++ b/spec/serializers/site_serializer_spec.rb
@@ -147,7 +147,7 @@ RSpec.describe SiteSerializer do
fab!(:staff_tag_group) { Fabricate(:tag_group, permissions: { "staff" => 1 }, tag_names: [hidden_tag.name]) }
before do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = true
SiteSetting.default_sidebar_tags = "#{tag.name}|#{tag2.name}|#{hidden_tag.name}"
end
@@ -160,8 +160,8 @@ RSpec.describe SiteSerializer do
expect(serialized[:anonymous_default_sidebar_tags]).to eq(nil)
end
- it 'is not included in the serialised object when experimental sidebar has not been enabled' do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it 'is not included in the serialised object when navigation menu is legacy' do
+ SiteSetting.navigation_menu = "legacy"
serialized = described_class.new(Site.new(guardian), scope: guardian, root: false).as_json
expect(serialized[:anonymous_default_sidebar_tags]).to eq(nil)
diff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rb
index 05765453258..44dd3c36f08 100644
--- a/spec/serializers/user_serializer_spec.rb
+++ b/spec/serializers/user_serializer_spec.rb
@@ -379,22 +379,22 @@ RSpec.describe UserSerializer do
context 'when viewing self' do
subject(:json) { UserSerializer.new(user, scope: Guardian.new(user), root: false).as_json }
- it "is not included when SiteSetting.enable_experimental_sidebar_hamburger is false" do
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ it "is not included when navigation menu is set to legacy" do
+ SiteSetting.navigation_menu = "legacy"
SiteSetting.tagging_enabled = true
expect(json[:sidebar_tags]).to eq(nil)
end
it "is not included when SiteSetting.tagging_enabled is false" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = false
expect(json[:sidebar_tags]).to eq(nil)
end
- it "is present when experimental sidebar and tagging has been enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ it "is present when sidebar and tagging has been enabled" do
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = true
tag_sidebar_section_link_2.linkable.update!(pm_topic_count: 5, topic_count: 0)
@@ -411,8 +411,8 @@ RSpec.describe UserSerializer do
subject(:json) { UserSerializer.new(user, scope: Guardian.new(user2), root: false).as_json }
- it "is not present even when experimental sidebar and tagging has been enabled" do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ it "is not present even when sidebar and tagging has been enabled" do
+ SiteSetting.navigation_menu = "sidebar"
SiteSetting.tagging_enabled = true
expect(json[:sidebar_tags]).to eq(nil)
diff --git a/spec/support/user_sidebar_tags_mixin.rb b/spec/support/user_sidebar_tags_mixin.rb
index 0b874c59e6d..65a1d113965 100644
--- a/spec/support/user_sidebar_tags_mixin.rb
+++ b/spec/support/user_sidebar_tags_mixin.rb
@@ -6,12 +6,12 @@ RSpec.shared_examples "#display_sidebar_tags" do |serializer_klass|
let(:serializer) { serializer_klass.new(user, scope: Guardian.new(user), root: false) }
before do
- SiteSetting.enable_experimental_sidebar_hamburger = true
+ SiteSetting.navigation_menu = "sidebar"
end
- it 'should not be included in serialised object when experimental hamburger and sidebar has been disabled' do
+ it 'should not be included in serialised object when navigation menu is legacy' do
SiteSetting.tagging_enabled = true
- SiteSetting.enable_experimental_sidebar_hamburger = false
+ SiteSetting.navigation_menu = "legacy"
expect(serializer.as_json[:display_sidebar_tags]).to eq(nil)
end