UX: Admin setting page consistency - Notifications (#30528)

Followup c2282439b3

Make the Notifications config page reached from the sidebar
use our consistent site setting page rules.
This commit is contained in:
Martin Brennan 2025-01-03 10:34:40 +10:00 committed by GitHub
parent 8316277b4b
commit 3260654505
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 74 additions and 11 deletions

View File

@ -0,0 +1,3 @@
import AdminAreaSettingsBaseController from "admin/controllers/admin-area-settings-base";
export default class AdminConfigNotificationsSettingsController extends AdminAreaSettingsBaseController {}

View File

@ -0,0 +1,8 @@
import DiscourseRoute from "discourse/routes/discourse";
import { i18n } from "discourse-i18n";
export default class AdminConfigNotificationsRoute extends DiscourseRoute {
titleToken() {
return i18n("admin.community.sidebar_link.notifications");
}
}

View File

@ -206,9 +206,18 @@ export default function () {
}); });
this.route("about"); this.route("about");
this.route("loginAndAuthentication", { path: "/" }, function () { this.route(
"loginAndAuthentication",
{ path: "/login-and-authentication" },
function () {
this.route("settings", { this.route("settings", {
path: "/login-and-authentication", path: "/",
});
}
);
this.route("notifications", function () {
this.route("settings", {
path: "/",
}); });
}); });
this.route("lookAndFeel", { path: "/look-and-feel" }, function () { this.route("lookAndFeel", { path: "/look-and-feel" }, function () {

View File

@ -0,0 +1,21 @@
<DPageHeader
@titleLabel={{i18n "admin.config.notifications.title"}}
@descriptionLabel={{i18n "admin.config.notifications.header_description"}}
>
<:breadcrumbs>
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
<DBreadcrumbsItem
@path="/admin/config/notifications"
@label={{i18n "admin.config.notifications.title"}}
/>
</:breadcrumbs>
</DPageHeader>
<div class="admin-config-page__main-area">
<AdminAreaSettings
@area="notifications"
@path="/admin/config/notifications"
@filter={{this.filter}}
@adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}
/>
</div>

View File

@ -48,9 +48,7 @@ export const ADMIN_NAV_MAP = [
}, },
{ {
name: "admin_notifications", name: "admin_notifications",
route: "adminSiteSettingsCategory", route: "adminConfig.notifications.settings",
routeModels: ["all_results"],
query: { filter: "notifications" },
label: "admin.community.sidebar_link.notifications", label: "admin.community.sidebar_link.notifications",
icon: "bell", icon: "bell",
}, },

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
class SiteSetting < ActiveRecord::Base class SiteSetting < ActiveRecord::Base
VALID_AREAS = %w[flags about emojis permalinks] VALID_AREAS = %w[flags about emojis permalinks notifications]
extend GlobalPath extend GlobalPath
extend SiteSettingExtension extend SiteSettingExtension

View File

@ -5137,6 +5137,9 @@ en:
login_and_authentication: login_and_authentication:
title: "Login and authentication" title: "Login and authentication"
header_description: "Configure how users log in and authenticate, secrets and keys, OAuth2 providers, and more." header_description: "Configure how users log in and authenticate, secrets and keys, OAuth2 providers, and more."
notifications:
title: "Notifications"
header_description: "Configure how notifications are managed and delivered for users, including email preferences, push notifications, mention limits, and notification consolidation."
new_features: new_features:
title: "What's new?" title: "What's new?"

View File

@ -391,9 +391,9 @@ Discourse::Application.routes.draw do
end end
namespace :config, constraints: StaffConstraint.new do namespace :config, constraints: StaffConstraint.new do
resources :site_settings, only: %i[index] resources :site_settings, only: %i[index]
resources :login_and_authentication, only: %i[index]
get "login-and-authentication" => "site_settings#index" get "login-and-authentication" => "site_settings#index"
get "notifications" => "site_settings#index"
resources :flags, only: %i[index new create update destroy] do resources :flags, only: %i[index new create update destroy] do
put "toggle" put "toggle"

View File

@ -53,7 +53,7 @@ required:
contact_email: contact_email:
default: "" default: ""
type: email type: email
area: "about" area: "about|notifications"
contact_url: contact_url:
default: "" default: ""
area: "about" area: "about"
@ -369,15 +369,19 @@ basic:
push_notifications_prompt: push_notifications_prompt:
default: true default: true
client: true client: true
area: "notifications"
push_notifications_icon: push_notifications_icon:
default: "" default: ""
type: upload type: upload
area: "notifications"
enable_desktop_push_notifications: enable_desktop_push_notifications:
default: true default: true
client: true client: true
area: "notifications"
push_notification_time_window_mins: push_notification_time_window_mins:
default: 1 default: 1
min: 0 min: 0
area: "notifications"
short_title: short_title:
default: "" default: ""
max: 12 max: 12
@ -817,6 +821,7 @@ users:
max_notifications_per_user: max_notifications_per_user:
default: 10000 default: 10000
hidden: true hidden: true
area: "notifications"
gravatar_name: gravatar_name:
default: Gravatar default: Gravatar
client: true client: true
@ -1034,12 +1039,17 @@ posting:
enable_mentions: enable_mentions:
default: true default: true
client: true client: true
max_mentions_per_post: 10 max_mentions_per_post:
default: 10
area: "notifications"
max_users_notified_per_group_mention: max_users_notified_per_group_mention:
default: 100 default: 100
client: true client: true
area: "notifications"
newuser_max_replies_per_topic: 3 newuser_max_replies_per_topic: 3
newuser_max_mentions_per_post: 2 newuser_max_mentions_per_post:
default: 2
area: "notifications"
here_mention: here_mention:
default: "here" default: "here"
validator: "NotUsernameValidator" validator: "NotUsernameValidator"
@ -1188,6 +1198,7 @@ posting:
type: float type: float
default: 24 default: 24
min: 0 min: 0
area: "notifications"
auto_close_messages_post_count: auto_close_messages_post_count:
default: 500 default: 500
auto_close_topics_post_count: auto_close_topics_post_count:
@ -2832,25 +2843,32 @@ uncategorized:
enable_listing_suspended_users_on_search: enable_listing_suspended_users_on_search:
default: false default: false
disable_system_edit_notifications: true disable_system_edit_notifications:
default: true
area: "notifications"
disable_category_edit_notifications: disable_category_edit_notifications:
default: false default: false
area: "notifications"
disable_tags_edit_notifications: disable_tags_edit_notifications:
default: false default: false
area: "notifications"
notification_consolidation_threshold: notification_consolidation_threshold:
default: 3 default: 3
min: 0 min: 0
area: "notifications"
likes_notification_consolidation_window_mins: likes_notification_consolidation_window_mins:
default: 120 default: 120
min: 1 min: 1
area: "notifications"
linked_notification_consolidation_window_mins: linked_notification_consolidation_window_mins:
default: 120 default: 120
min: 1 min: 1
area: "notifications"
delete_drafts_older_than_n_days: delete_drafts_older_than_n_days:
default: 180 default: 180
@ -3050,6 +3068,7 @@ user_preferences:
default_other_notification_level_when_replying: default_other_notification_level_when_replying:
enum: "NotificationLevelWhenReplyingSiteSetting" enum: "NotificationLevelWhenReplyingSiteSetting"
default: 2 default: 2
area: "notifications"
default_other_external_links_in_new_tab: false default_other_external_links_in_new_tab: false
default_other_enable_quoting: true default_other_enable_quoting: true
default_other_enable_defer: false default_other_enable_defer: false
@ -3059,6 +3078,7 @@ user_preferences:
default_other_like_notification_frequency: default_other_like_notification_frequency:
enum: "LikeNotificationFrequencySiteSetting" enum: "LikeNotificationFrequencySiteSetting"
default: 1 default: 1
area: "notifications"
default_topics_automatic_unpin: default_topics_automatic_unpin:
default: true default: true

View File

@ -114,6 +114,7 @@ chat:
default: 5 default: 5
max: 10 max: 10
min: 0 min: 0
area: "notifications"
max_chat_draft_length: max_chat_draft_length:
default: 50_000 default: 50_000
hidden: true hidden: true