From 3ce386c22f9d5b7ec574b63a2a3ba6b8c8842f1f Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Mon, 8 Apr 2024 09:57:27 +1000 Subject: [PATCH] FEATURE: enable new admin sidebar by default (#26391) By default, enable the new admin sidebar. In addition, migration was created for old sites to keep the old admin panel. --- config/site_settings.yml | 2 +- ...3_disable_admin_sidebar_for_existing_sites.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20240327043323_disable_admin_sidebar_for_existing_sites.rb diff --git a/config/site_settings.yml b/config/site_settings.yml index f17c60852ac..519879096d6 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -2361,7 +2361,7 @@ developer: admin_sidebar_enabled_groups: type: group_list list_type: compact - default: "" + default: "1" allow_any: false refresh: true lazy_load_categories_groups: diff --git a/db/migrate/20240327043323_disable_admin_sidebar_for_existing_sites.rb b/db/migrate/20240327043323_disable_admin_sidebar_for_existing_sites.rb new file mode 100644 index 00000000000..c64cfc6dd67 --- /dev/null +++ b/db/migrate/20240327043323_disable_admin_sidebar_for_existing_sites.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class DisableAdminSidebarForExistingSites < ActiveRecord::Migration[7.0] + def up + # keep old admin menu for existing sites + execute <<~SQL if Migration::Helpers.existing_site? + INSERT INTO site_settings(name, data_type, value, created_at, updated_at) + VALUES('admin_sidebar_enabled_groups', 20, '-1', NOW(), NOW()) + ON CONFLICT (name) DO NOTHING + SQL + end + + def down + raise ActiveRecord::IrreversibleMigration + end +end