From 32c6d3be06e2c4069de69e20903e5ecf8cf61f5e Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Wed, 22 Jan 2025 10:21:30 +1000 Subject: [PATCH] FIX: Admin sidebar problem check missing -1 check (#30916) When we initially turned on admin sidebar for new sites, existing sites had the value set to -1. We need to show the problem check to these sites too, but currently it only checks if `admin_sidebar_enabled_groups` is empty. --- .../problem_check/admin_sidebar_deprecation.rb | 5 ++++- config/locales/server.en.yml | 2 +- .../problem_check/admin_sidebar_deprecation_spec.rb | 12 +++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/services/problem_check/admin_sidebar_deprecation.rb b/app/services/problem_check/admin_sidebar_deprecation.rb index 637c2253925..019ea60b909 100644 --- a/app/services/problem_check/admin_sidebar_deprecation.rb +++ b/app/services/problem_check/admin_sidebar_deprecation.rb @@ -4,7 +4,10 @@ class ProblemCheck::AdminSidebarDeprecation < ProblemCheck::ProblemCheck self.priority = "low" def call - return no_problem if SiteSetting.admin_sidebar_enabled_groups.present? + if SiteSetting.admin_sidebar_enabled_groups.present? && + SiteSetting.admin_sidebar_enabled_groups != "-1" + return no_problem + end problem end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 8148e65edf6..38e5b0c7e3e 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1724,7 +1724,7 @@ en: google_analytics_version: "Your Discourse is currently using Google Analytics 3, which will no longer be supported after July 2023. Upgrade to Google Analytics 4 now to continue receiving valuable insights and analytics for your website's performance." category_style_deprecated: "Your Discourse is currently using a deprecated category style which will be removed before the final beta release of Discourse 3.2. Please refer to Moving to a Single Category Style Site Setting for instructions on how to keep your selected category style." maxmind_db_configuration: 'The server has been configured to use MaxMind databases for reverse IP lookups but a valid MaxMind account ID has not been configured which may result in MaxMind databases failing to download in the future. See this guide to learn more.' - admin_sidebar_deprecation: "The old admin layout is deprecated in favour of the new sidebar layout and will be removed in the next release. You can configure the new sidebar layout now to opt in before that." + admin_sidebar_deprecation: "The old admin layout is deprecated in favour of the new sidebar layout and will be removed in the next release. You can configure the new sidebar layout now to opt in before that." back_from_logster_text: "Back to site" site_settings: diff --git a/spec/services/problem_check/admin_sidebar_deprecation_spec.rb b/spec/services/problem_check/admin_sidebar_deprecation_spec.rb index feb80773ad9..aa684df7de1 100644 --- a/spec/services/problem_check/admin_sidebar_deprecation_spec.rb +++ b/spec/services/problem_check/admin_sidebar_deprecation_spec.rb @@ -17,7 +17,17 @@ RSpec.describe ProblemCheck::AdminSidebarDeprecation do it do expect(check).to have_a_problem.with_priority("low").with_message( - "The old admin layout is deprecated in favour of the new sidebar layout and will be removed in the next release. You can configure the new sidebar layout now to opt in before that.", + "The old admin layout is deprecated in favour of the new sidebar layout and will be removed in the next release. You can configure the new sidebar layout now to opt in before that.", + ) + end + end + + context "when sidebar is set to -1 from the initial migration" do + let(:configured) { "-1" } + + it do + expect(check).to have_a_problem.with_priority("low").with_message( + "The old admin layout is deprecated in favour of the new sidebar layout and will be removed in the next release. You can configure the new sidebar layout now to opt in before that.", ) end end