UX: Enable new notifications menu by default (#21060)

https://meta.discourse.org/t/260358
This commit is contained in:
David Taylor 2023-04-12 09:45:29 +01:00 committed by GitHub
parent 2eb60c9713
commit 121d5c6c6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 38 deletions

View File

@ -2406,7 +2406,7 @@ en:
navigation_menu: "Determine which navigation menu to use. Sidebar and header navigation are customizable by users. Legacy option is available for backward compatibility." navigation_menu: "Determine which navigation menu to use. Sidebar and header navigation are customizable by users. Legacy option is available for backward compatibility."
default_sidebar_categories: "Selected categories will be displayed under Sidebar's Categories section by default." 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." default_sidebar_tags: "Selected tags will be displayed under Sidebar's Tags section by default."
enable_new_notifications_menu: "Enables the new notifications menu for the legacy navigation menu." enable_new_notifications_menu: "Enables the new notifications menu. Disabling this setting is deprecated. The new notifications menu is always used for non-legacy 'navigation menu' choices. <a href='https://meta.discourse.org/t/260358'>Learn more</a>"
enable_experimental_hashtag_autocomplete: "EXPERIMENTAL: Use the new #hashtag autocompletion system for categories and tags that renders the selected item differently and has improved search" enable_experimental_hashtag_autocomplete: "EXPERIMENTAL: Use the new #hashtag autocompletion system for categories and tags that renders the selected item differently and has improved search"
experimental_new_new_view_groups: "EXPERIMENTAL: Enable a new topics list that combines unread and new topics and make the \"Everything\" link in the sidebar link to it." experimental_new_new_view_groups: "EXPERIMENTAL: Enable a new topics list that combines unread and new topics and make the \"Everything\" link in the sidebar link to it."
enable_custom_sidebar_sections: "EXPERIMENTAL: Enable custom sidebar sections" enable_custom_sidebar_sections: "EXPERIMENTAL: Enable custom sidebar sections"
@ -2467,7 +2467,6 @@ en:
discourse_connect_cannot_be_enabled_if_second_factor_enforced: "You cannot enable DiscourseConnect if 2FA is enforced." discourse_connect_cannot_be_enabled_if_second_factor_enforced: "You cannot enable DiscourseConnect if 2FA is enforced."
delete_rejected_email_after_days: "This setting cannot be set lower than the delete_email_logs_after_days setting or greater than %{max}" delete_rejected_email_after_days: "This setting cannot be set lower than the delete_email_logs_after_days setting or greater than %{max}"
invalid_uncategorized_category_setting: 'The "Uncategorized" category cannot be selected if ''allow uncategorized topics'' is not enabled.' invalid_uncategorized_category_setting: 'The "Uncategorized" category cannot be selected if ''allow uncategorized topics'' is not enabled.'
enable_new_notifications_menu_not_legacy_navigation_menu: "You must set `navigation_menu` to `legacy` before enabling this setting."
invalid_search_ranking_weights: "Value is invalid for search_ranking_weights site setting. Example: '{0.1,0.2,0.3,1.0}'. Note that maximum value for each weight is 1.0." invalid_search_ranking_weights: "Value is invalid for search_ranking_weights site setting. Example: '{0.1,0.2,0.3,1.0}'. Note that maximum value for each weight is 1.0."
placeholder: placeholder:

View File

@ -2116,8 +2116,7 @@ navigation:
- "default" - "default"
- "unread_new" - "unread_new"
enable_new_notifications_menu: enable_new_notifications_menu:
default: false default: true
validator: "EnableNewNotificationsMenuValidator"
enable_custom_sidebar_sections: enable_custom_sidebar_sections:
client: true client: true
type: group_list type: group_list

View File

@ -1,15 +0,0 @@
# frozen_string_literal: true
class EnableNewNotificationsMenuValidator
def initialize(opts = {})
end
def valid_value?(value)
return true if value == "f"
SiteSetting.navigation_menu == "legacy"
end
def error_message
I18n.t("site_settings.errors.enable_new_notifications_menu_not_legacy_navigation_menu")
end
end

View File

@ -1,18 +0,0 @@
# frozen_string_literal: true
RSpec.describe EnableNewNotificationsMenuValidator do
it "does not allow `enable_new_notifications_menu` site settings to be enabled when `navigation_menu` site settings is not set to `legacy`" do
SiteSetting.navigation_menu = "sidebar"
expect { SiteSetting.enable_new_notifications_menu = true }.to raise_error(
Discourse::InvalidParameters,
/#{I18n.t("site_settings.errors.enable_new_notifications_menu_not_legacy_navigation_menu")}/,
)
end
it "allows `enable_new_notifications_menu` site settings to be enabled when `navigation_menu` site settings is set to `legacy`" do
SiteSetting.navigation_menu = "legacy"
expect { SiteSetting.enable_new_notifications_menu = true }.to_not raise_error
end
end

View File

@ -283,8 +283,9 @@ RSpec.describe CurrentUserSerializer do
) )
end end
it "isn't included when navigation menu is legacy" do it "isn't included when navigation menu is legacy with old user menu" do
SiteSetting.navigation_menu = "legacy" SiteSetting.navigation_menu = "legacy"
SiteSetting.enable_new_notifications_menu = false
expect(serializer.as_json[:new_personal_messages_notifications_count]).to be_nil expect(serializer.as_json[:new_personal_messages_notifications_count]).to be_nil
end end