UX: Admin setting page consistency - Group permissions (#30528) (#30578)

* UX: Admin setting page consistency - Group permissions (#30528)

Followup c2282439b3 and
21470e4afd

Adds a new "Group permissions" page and group_permissions site
setting area, which shows every single group-based site setting
in the app and core plugins.

Also adds a "trust_levels" area to show on the already moved
admin "Trust level" settings page, since that previously was
showing a mix of trust level settings and allowed group settings.

* DEV: Review fixes
This commit is contained in:
Martin Brennan 2025-01-07 11:25:21 +10:00 committed by GitHub
parent fd909dd348
commit 30be75460f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 168 additions and 21 deletions

View File

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

View File

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

View File

@ -241,6 +241,15 @@ export default function () {
path: "/", path: "/",
}); });
}); });
this.route(
"groupPermissions",
{ path: "/group-permissions" },
function () {
this.route("settings", {
path: "/",
});
}
);
this.route("trustLevels", { path: "/trust-levels" }, function () { this.route("trustLevels", { path: "/trust-levels" }, function () {
this.route("settings", { this.route("settings", {
path: "/", path: "/",

View File

@ -0,0 +1,31 @@
import RouteTemplate from "ember-route-template";
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
import DPageHeader from "discourse/components/d-page-header";
import { i18n } from "discourse-i18n";
import AdminAreaSettings from "admin/components/admin-area-settings";
export default RouteTemplate(<template>
<DPageHeader
@titleLabel={{i18n "admin.config.group_permissions.title"}}
@descriptionLabel={{i18n
"admin.config.group_permissions.header_description"
}}
>
<:breadcrumbs>
<DBreadcrumbsItem @path="/admin" @label={{i18n "admin_title"}} />
<DBreadcrumbsItem
@path="/admin/config/group-permissions"
@label={{i18n "admin.config.group_permissions.title"}}
/>
</:breadcrumbs>
</DPageHeader>
<div class="admin-config-page__main-area">
<AdminAreaSettings
@area="group_permissions"
@path="/admin/config/group-permissions"
@filter={{@controller.filter}}
@adminSettingsFilterChangedCallback={{@controller.adminSettingsFilterChangedCallback}}
/>
</div>
</template>);

View File

@ -14,7 +14,7 @@
<div class="admin-config-page__main-area"> <div class="admin-config-page__main-area">
<AdminAreaSettings <AdminAreaSettings
@categories="trust" @area="trust_levels"
@path="/admin/config/trust-levels" @path="/admin/config/trust-levels"
@filter={{this.filter}} @filter={{this.filter}}
@adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}} @adminSettingsFilterChangedCallback={{this.adminSettingsFilterChangedCallback}}

View File

@ -64,6 +64,12 @@ export const ADMIN_NAV_MAP = [
label: "admin.community.sidebar_link.trust_levels", label: "admin.community.sidebar_link.trust_levels",
icon: "user-shield", icon: "user-shield",
}, },
{
name: "admin_group_permissions",
route: "adminConfig.groupPermissions.settings",
label: "admin.community.sidebar_link.group_permissions",
icon: "user-gear",
},
{ {
name: "admin_user_fields", name: "admin_user_fields",
route: "adminUserFields", route: "adminUserFields",

View File

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

View File

@ -5136,28 +5136,31 @@ en:
config: config:
font_style: font_style:
title: "Font style" title: "Font style"
header_description: "Customize the font styles used by your themes." header_description: "Customize the font styles used by your themes"
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"
logo: logo:
title: "Site logo" title: "Site logo"
header_description: "Customize the variations of your site logo." header_description: "Customize the variations of your site logo"
navigation: navigation:
title: "Navigation" title: "Navigation"
header_description: "Configure the navigation links and menu items for your site. This includes the location and behaviour of the primary navigation menu, the quick links at the top of the homepage, as well as the admin sidebar." header_description: "Configure the navigation links and menu items for your site. This includes the location and behaviour of the primary navigation menu, the quick links at the top of the homepage, as well as the admin sidebar."
notifications: notifications:
title: "Notifications" title: "Notifications"
header_description: "Configure how notifications are managed and delivered for users, including email preferences, push notifications, mention limits, and notification consolidation." header_description: "Configure how notifications are managed and delivered for users, including email preferences, push notifications, mention limits, and notification consolidation"
search: search:
title: "Search" title: "Search"
header_description: "Configure search settings including logging and tokenization for Chinese and Japanese languages." header_description: "Configure search settings including logging and tokenization for Chinese and Japanese languages"
legal: legal:
title: "Legal" title: "Legal"
header_description: "Configure legal settings, such as terms of service, privacy policy, contact details, and EU-specific considerations." header_description: "Configure legal settings, such as terms of service, privacy policy, contact details, and EU-specific considerations"
trust_levels: trust_levels:
title: "Trust levels" title: "Trust levels"
header_description: "Trust level settings allow you to fine-tune the requirements and notifications for your communitys progression system, which automatically promotes users to higher trust levels as they demonstrate consistent, positive engagement with your forum." header_description: "Trust level settings allow you to fine-tune the requirements and notifications for your communitys progression system, which automatically promotes users to higher trust levels as they demonstrate consistent, positive engagement with your forum"
group_permissions:
title: "Group permissions"
header_description: "All group-based app permissions are managed here, which control access to various features within Discourse"
new_features: new_features:
title: "What's new?" title: "What's new?"
@ -5636,6 +5639,7 @@ en:
notifications: "Notifications" notifications: "Notifications"
permalinks: "Permalinks" permalinks: "Permalinks"
trust_levels: "Trust levels" trust_levels: "Trust levels"
group_permissions: "Group permissions"
users: "Users" users: "Users"
groups: "Groups" groups: "Groups"
user_fields: "User fields" user_fields: "User fields"

View File

@ -401,6 +401,7 @@ Discourse::Application.routes.draw do
get "search" => "site_settings#index" get "search" => "site_settings#index"
get "legal" => "site_settings#index" get "legal" => "site_settings#index"
get "trust-levels" => "site_settings#index" get "trust-levels" => "site_settings#index"
get "group-permissions" => "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

@ -367,12 +367,14 @@ basic:
default: "" default: ""
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
hidden_post_visible_groups: hidden_post_visible_groups:
type: group_list type: group_list
list_type: compact list_type: compact
default: "14" default: "14"
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
push_notifications_prompt: push_notifications_prompt:
default: true default: true
client: true client: true
@ -437,6 +439,7 @@ basic:
about_page_hidden_groups: about_page_hidden_groups:
default: "" default: ""
type: group_list type: group_list
area: "group_permissions"
adobe_analytics_tags_url: adobe_analytics_tags_url:
default: "" default: ""
regex: "assets.adobedtm.com" regex: "assets.adobedtm.com"
@ -784,6 +787,7 @@ users:
allow_any: false allow_any: false
refresh: true refresh: true
validator: "AtLeastOneGroupValidator" validator: "AtLeastOneGroupValidator"
area: "group_permissions"
anonymous_account_duration_minutes: anonymous_account_duration_minutes:
default: 10080 default: 10080
max: 99000 max: 99000
@ -976,6 +980,7 @@ posting:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
editing_grace_period: 300 editing_grace_period: 300
editing_grace_period_max_diff: 100 editing_grace_period_max_diff: 100
editing_grace_period_max_diff_high_trust: 400 editing_grace_period_max_diff_high_trust: 400
@ -993,6 +998,7 @@ posting:
allow_any: false allow_any: false
refresh: true refresh: true
validator: "AtLeastOneGroupValidator" validator: "AtLeastOneGroupValidator"
area: "group_permissions"
post_edit_time_limit: post_edit_time_limit:
default: 1440 default: 1440
max: 10080 max: 10080
@ -1075,6 +1081,7 @@ posting:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
title_max_word_length: title_max_word_length:
default: 30 default: 30
locale_default: locale_default:
@ -1190,6 +1197,7 @@ posting:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
approve_new_topics_unless_trust_level: approve_new_topics_unless_trust_level:
default: 0 default: 0
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1200,6 +1208,7 @@ posting:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
approve_suspect_users: approve_suspect_users:
default: true default: true
approve_unless_staged: approve_unless_staged:
@ -1293,6 +1302,7 @@ posting:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
blur_tl0_flagged_posts_media: blur_tl0_flagged_posts_media:
default: true default: true
client: true client: true
@ -1416,6 +1426,7 @@ email:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
email_in_authserv_id: email_in_authserv_id:
default: "" default: ""
email_in_spam_header: email_in_spam_header:
@ -1572,6 +1583,7 @@ email:
default: "1|2" default: "1|2"
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
files: files:
max_image_size_kb: max_image_size_kb:
@ -1723,10 +1735,11 @@ files:
enum: "TrustLevelAndStaffAndDisabledSetting" enum: "TrustLevelAndStaffAndDisabledSetting"
hidden: true hidden: true
uploaded_avatars_allowed_groups: uploaded_avatars_allowed_groups:
default: 10 default: "10"
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
default_avatars: default_avatars:
default: "" default: ""
type: url_list type: url_list
@ -1844,9 +1857,11 @@ trust:
default_trust_level: default_trust_level:
default: 0 default: 0
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
area: "trust_levels"
default_invitee_trust_level: default_invitee_trust_level:
default: 1 default: 1
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
area: "trust_levels"
min_trust_to_create_topic: min_trust_to_create_topic:
default: 0 default: 0
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1857,6 +1872,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_edit_wiki_post: min_trust_to_edit_wiki_post:
default: 1 default: 1
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1867,6 +1883,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_edit_post: min_trust_to_edit_post:
default: 0 default: 0
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1877,6 +1894,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_allow_self_wiki: min_trust_to_allow_self_wiki:
default: 3 default: 3
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1887,6 +1905,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_send_email_messages: min_trust_to_send_email_messages:
default: "4" default: "4"
enum: "TrustLevelAndStaffSetting" enum: "TrustLevelAndStaffSetting"
@ -1897,6 +1916,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_flag_posts: min_trust_to_flag_posts:
default: 1 default: 1
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1907,6 +1927,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_post_links: min_trust_to_post_links:
default: 0 default: 0
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1917,6 +1938,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_to_post_embedded_media: min_trust_to_post_embedded_media:
default: 0 default: 0
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1927,6 +1949,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_level_to_allow_profile_background: min_trust_level_to_allow_profile_background:
default: 0 default: 0
client: true client: true
@ -1938,6 +1961,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_level_to_allow_user_card_background: min_trust_level_to_allow_user_card_background:
default: 0 default: 0
client: true client: true
@ -1949,6 +1973,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_level_to_allow_invite: min_trust_level_to_allow_invite:
default: 2 default: 2
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1959,6 +1984,7 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_level_to_allow_ignore: min_trust_level_to_allow_ignore:
default: 2 default: 2
enum: "TrustLevelSetting" enum: "TrustLevelSetting"
@ -1970,74 +1996,111 @@ trust:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
allow_flagging_staff: true allow_flagging_staff: true
send_tl1_welcome_message: true send_tl1_welcome_message: true
send_tl2_promotion_message: true send_tl2_promotion_message: true
tl1_requires_topics_entered: 5 tl1_requires_topics_entered:
default: 5
area: "trust_levels"
tl1_requires_read_posts: tl1_requires_read_posts:
default: 30 default: 30
client: true client: true
tl1_requires_time_spent_mins: 10 area: "trust_levels"
tl2_requires_topics_entered: 20 tl1_requires_time_spent_mins:
tl2_requires_read_posts: 100 default: 10
tl2_requires_time_spent_mins: 60 area: "trust_levels"
tl2_requires_topics_entered:
default: 20
area: "trust_levels"
tl2_requires_read_posts:
default: 100
area: "trust_levels"
tl2_requires_time_spent_mins:
default: 60
area: "trust_levels"
tl2_requires_days_visited: tl2_requires_days_visited:
default: 15 default: 15
max: 36500 max: 36500
tl2_requires_likes_received: 1 area: "trust_levels"
tl2_requires_likes_given: 1 tl2_requires_likes_received:
tl2_requires_topic_reply_count: 3 default: 1
area: "trust_levels"
tl2_requires_likes_given:
default: 1
area: "trust_levels"
tl2_requires_topic_reply_count:
default: 3
area: "trust_levels"
tl3_time_period: tl3_time_period:
default: 100 default: 100
min: 1 min: 1
max: 1000000 max: 1000000
area: "trust_levels"
tl3_requires_days_visited: tl3_requires_days_visited:
default: 50 default: 50
max: 36500 max: 36500
area: "trust_levels"
tl3_requires_topics_replied_to: tl3_requires_topics_replied_to:
default: 10 default: 10
area: "trust_levels"
tl3_requires_topics_viewed: tl3_requires_topics_viewed:
default: 25 default: 25
max: 100 max: 100
area: "trust_levels"
tl3_requires_topics_viewed_cap: tl3_requires_topics_viewed_cap:
default: 500 default: 500
area: "trust_levels"
tl3_requires_posts_read: tl3_requires_posts_read:
default: 25 default: 25
max: 100 max: 100
area: "trust_levels"
tl3_requires_posts_read_cap: tl3_requires_posts_read_cap:
default: 20000 default: 20000
max: 99000 max: 99000
area: "trust_levels"
tl3_requires_topics_viewed_all_time: tl3_requires_topics_viewed_all_time:
default: 200 default: 200
area: "trust_levels"
tl3_requires_posts_read_all_time: tl3_requires_posts_read_all_time:
default: 500 default: 500
area: "trust_levels"
tl3_requires_max_flagged: tl3_requires_max_flagged:
default: 5 default: 5
area: "trust_levels"
tl3_promotion_min_duration: tl3_promotion_min_duration:
default: 14 default: 14
max: 10000 max: 10000
area: "trust_levels"
tl3_requires_likes_given: tl3_requires_likes_given:
default: 30 default: 30
area: "trust_levels"
tl3_requires_likes_received: tl3_requires_likes_received:
default: 20 default: 20
area: "trust_levels"
tl3_links_no_follow: tl3_links_no_follow:
default: false default: false
client: true client: true
area: "trust_levels"
tl4_delete_posts_and_topics: tl4_delete_posts_and_topics:
default: false default: false
client: true client: true
hidden: true hidden: true
area: "trust_levels"
delete_all_posts_and_topics_allowed_groups: delete_all_posts_and_topics_allowed_groups:
default: "" default: ""
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
edit_all_topic_groups: edit_all_topic_groups:
default: "13" default: "13"
type: group_list type: group_list
area: "group_permissions"
edit_all_post_groups: edit_all_post_groups:
default: "14" default: "14"
type: group_list type: group_list
area: "group_permissions"
security: security:
detailed_404: false detailed_404: false
@ -2188,6 +2251,7 @@ security:
allow_any: false allow_any: false
refresh: true refresh: true
hidden: true hidden: true
area: "group_permissions"
onebox: onebox:
post_onebox_maxlength: post_onebox_maxlength:
@ -2508,7 +2572,7 @@ developer:
default: "1|2" default: "1|2"
allow_any: false allow_any: false
refresh: true refresh: true
area: "navigation" area: "group_permissions|navigation"
warn_critical_js_deprecations: warn_critical_js_deprecations:
default: true default: true
client: true client: true
@ -3220,6 +3284,7 @@ user_api:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
allowed_user_api_push_urls: allowed_user_api_push_urls:
default: "" default: ""
type: list type: list
@ -3281,6 +3346,7 @@ tags:
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
min_trust_level_to_tag_topics: min_trust_level_to_tag_topics:
default: "0" default: "0"
enum: "TrustLevelAndStaffSetting" enum: "TrustLevelAndStaffSetting"
@ -3293,6 +3359,7 @@ tags:
allow_any: false allow_any: false
refresh: true refresh: true
client: true client: true
area: "group_permissions"
max_tag_search_results: max_tag_search_results:
client: true client: true
default: 5 default: 5
@ -3315,6 +3382,7 @@ tags:
default: "" default: ""
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
suppress_overlapping_tags_in_list: suppress_overlapping_tags_in_list:
default: false default: false
client: true client: true
@ -3400,7 +3468,7 @@ experimental:
default: "" default: ""
allow_any: false allow_any: false
refresh: true refresh: true
area: "navigation" area: "group_permissions|navigation"
glimmer_topic_list_mode: glimmer_topic_list_mode:
client: true client: true
type: enum type: enum
@ -3431,3 +3499,4 @@ experimental:
default: "" default: ""
type: group_list type: group_list
list_type: compact list_type: compact
area: "group_permissions"

View File

@ -12,6 +12,7 @@ chat:
mandatory_values: "1|2" # @admins, @moderators mandatory_values: "1|2" # @admins, @moderators
allow_any: false allow_any: false
refresh: true refresh: true
area: "group_permissions"
chat_threads_enabled: chat_threads_enabled:
client: true client: true
default: false default: false
@ -101,13 +102,14 @@ chat:
allow_any: false allow_any: false
refresh: true refresh: true
validator: "Chat::DirectMessageEnabledGroupsValidator" validator: "Chat::DirectMessageEnabledGroupsValidator"
area: "group_permissions"
chat_message_flag_allowed_groups: chat_message_flag_allowed_groups:
default: "1|2|11" # @admins, @moderators, @trust_level_1 default: "1|2|11" # @admins, @moderators, @trust_level_1
mandatory_values: "1|2" # @admins, @moderators mandatory_values: "1|2" # @admins, @moderators
type: group_list type: group_list
allow_any: false allow_any: false
refresh: true refresh: true
area: "flags" area: "flags|group_permissions"
max_mentions_per_chat_message: max_mentions_per_chat_message:
client: true client: true
type: integer type: integer

View File

@ -22,6 +22,7 @@ plugins:
allow_any: false allow_any: false
refresh: true refresh: true
validator: "AtLeastOneGroupValidator" validator: "AtLeastOneGroupValidator"
area: "group_permissions"
poll_groupable_user_fields: poll_groupable_user_fields:
default: "" default: ""
type: list type: list

View File

@ -11,3 +11,4 @@ plugins:
allow_any: false allow_any: false
refresh: true refresh: true
validator: "AtLeastOneGroupValidator" validator: "AtLeastOneGroupValidator"
area: "group_permissions"