DEV: Migrate sidebar site settings (#19336)

This new site setting replaces the
`enable_experimental_sidebar_hamburger` and `enable_sidebar` site
settings as the sidebar feature exits the experimental phase.

Note that we're replacing this without depreciation since the previous
site setting was considered experimental.

Internal Ref: /t/86563
This commit is contained in:
Alan Guo Xiang Tan 2022-12-08 09:44:29 +08:00 committed by GitHub
parent f7f0ca801b
commit fde9e6bc25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
77 changed files with 254 additions and 265 deletions

View File

@ -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
);
},
}
);

View File

@ -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"}}

View File

@ -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() {

View File

@ -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" }
);
}

View File

@ -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>

View File

@ -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"}}

View File

@ -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>
`,
});

View File

@ -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 {

View File

@ -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");

View File

@ -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) {

View File

@ -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) {

View File

@ -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,
});

View File

@ -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,
});

View File

@ -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();

View File

@ -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) {

View File

@ -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(() => {

View File

@ -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,
});

View File

@ -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) => {

View File

@ -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) => {

View File

@ -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({

View File

@ -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) {

View File

@ -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,
});

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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',

View File

@ -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)

View File

@ -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?

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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:

View File

@ -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) ثانية قبل إنشاء موضوع آخر."

View File

@ -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."

View File

@ -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"

View File

@ -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."

View File

@ -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."

View File

@ -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."

View File

@ -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) שניות לפני שיוכלו ליצור נושא אחר."

View File

@ -962,8 +962,6 @@ hu:
min_password_length: "Minimum jelszóhossz."
block_common_passwords: "A 10000 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."

View File

@ -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."

View File

@ -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) 秒待ってから次のトピックを作成する必要があります。"

View File

@ -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."

View File

@ -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."

View File

@ -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."

View File

@ -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: "Новички могут создавать новую тему после создания предыдущей только по прошествии указанного здесь количества секунд."

View File

@ -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."

View File

@ -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."

View File

@ -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) секунд, перш ніж створювати нову тему."

View File

@ -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."

View File

@ -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) 秒才能创建另一个话题。"

View File

@ -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) 秒才能建立另一個新話題"

View File

@ -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: ""

View File

@ -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

View File

@ -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

View File

@ -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";
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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) => {

View File

@ -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) => {

View File

@ -61,7 +61,6 @@ acceptance(
needs.settings({
chat_enabled: true,
chat_allow_archiving_channels: true,
enable_sidebar: false,
});
needs.pretender((server, helper) => {

View File

@ -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) => {

View File

@ -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;
});

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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