FEATURE: Split navigation preference for count and behavior of sidebar links (#22203)

This PR splits up the preference that controls the count vs dot and destination of sidebar links, which is really hard to understand, into 2 simpler checkboxes:

The new preferences/checkboxes are off by default, but there are database migrations to switch the old preference to the new ones so that existing users don't have to update their preferences to keep their preferred behavior of sidebar links when this changed is rolled out.

Internal topic: t/103529.
This commit is contained in:
Osama Sayegh
2023-06-22 19:04:13 +03:00
committed by GitHub
parent fcaa9757f3
commit b27e12445d
30 changed files with 788 additions and 249 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class AddSidebarLinkToFilteredListToUserOption < ActiveRecord::Migration[7.0]
def change
add_column :user_options, :sidebar_link_to_filtered_list, :boolean, default: false, null: false
execute <<~SQL
UPDATE user_options
SET sidebar_link_to_filtered_list = true
WHERE sidebar_list_destination = 1
SQL
end
end

View File

@ -0,0 +1,17 @@
# frozen_string_literal: true
class AddSidebarShowCountOfNewItemsToUserOption < ActiveRecord::Migration[7.0]
def change
add_column :user_options,
:sidebar_show_count_of_new_items,
:boolean,
default: false,
null: false
execute <<~SQL
UPDATE user_options
SET sidebar_show_count_of_new_items = true
WHERE sidebar_list_destination = 1
SQL
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class RemoveDefaultSidebarListDestinationSetting < ActiveRecord::Migration[7.0]
def up
execute("DELETE FROM site_settings WHERE name = 'default_sidebar_list_destination'")
end
def down
raise ActiveRecord::IrreversibleMigration
end
end