From ca26099a8d040f269846013ee0b74be0657e6b0c Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Fri, 30 Aug 2024 10:52:34 +1000 Subject: [PATCH] UX: Add descriptions to auto groups and auto group indicator (#28630) This commit adds a description for all the auto groups which will be shown in the group list and show group pages, which will help admins understand their purpose better. Also adds an indicator with a tooltip to explain what the auto groups are on the group show page. --- .../discourse/app/templates/group.hbs | 13 +++++++++++++ app/assets/stylesheets/common/base/groups.scss | 16 ++++++++++++++++ app/serializers/basic_group_serializer.rb | 12 +++++++++--- config/locales/client.en.yml | 1 + config/locales/server.en.yml | 14 ++++++++++++++ 5 files changed, 53 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/templates/group.hbs b/app/assets/javascripts/discourse/app/templates/group.hbs index a85280559cf..400df39660b 100644 --- a/app/assets/javascripts/discourse/app/templates/group.hbs +++ b/app/assets/javascripts/discourse/app/templates/group.hbs @@ -40,6 +40,18 @@ {{this.model.name}} {{/if}} + + {{#if this.model.automatic}} + + <:trigger> + {{d-icon "cog"}} + {{i18n "admin.groups.manage.membership.automatic"}} + + <:content> + {{i18n "admin.groups.manage.membership.automatic_tooltip"}} + + + {{/if}}
@@ -95,6 +107,7 @@

{{html-safe this.model.bio_cooked}}

{{/if}} +
diff --git a/app/assets/stylesheets/common/base/groups.scss b/app/assets/stylesheets/common/base/groups.scss index f1e69dd2581..068c67b3165 100644 --- a/app/assets/stylesheets/common/base/groups.scss +++ b/app/assets/stylesheets/common/base/groups.scss @@ -179,3 +179,19 @@ } } } + +.admin-group-automatic-tooltip { + align-items: center; + font-size: var(--font-down-2); + padding: 0.2em 1em; + background-color: var(--primary-low); + border-radius: var(--d-button-border-radius); + + .fk-d-tooltip__trigger-container { + align-items: center; + + .d-icon { + margin-right: 0.25em; + } + } +} diff --git a/app/serializers/basic_group_serializer.rb b/app/serializers/basic_group_serializer.rb index f5d4c80d365..5f6ec2cffb1 100644 --- a/app/serializers/basic_group_serializer.rb +++ b/app/serializers/basic_group_serializer.rb @@ -44,10 +44,16 @@ class BasicGroupSerializer < ApplicationSerializer end end - def bio_excerpt - if object.bio_cooked.present? - PrettyText.excerpt(object.bio_cooked, 110, keep_emoji_images: true) + def bio_cooked + if object.automatic + return I18n.t("groups.default_descriptions.#{Group::AUTO_GROUP_IDS[object.id]}") end + + object.bio_cooked + end + + def bio_excerpt + PrettyText.excerpt(bio_cooked, 200, keep_emoji_images: true) if bio_cooked.present? end def include_incoming_email? diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4b2766d735c..c1b6f88b045 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -5200,6 +5200,7 @@ en: membership: automatic: Automatic + automatic_tooltip: "This group is automatic, you cannot delete it and members are added and removed automatically" trust_levels_title: "Trust level automatically granted to members when they're added:" effects: Effects trust_levels_none: "None" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index ad01fea739c..dfb343fe49b 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -639,6 +639,20 @@ en: trust_level_2: "trust_level_2" trust_level_3: "trust_level_3" trust_level_4: "trust_level_4" + default_descriptions: + everyone: "Automatic group including all members" + staff: "Automatic group including admins and moderators" + admins: "Responsible for configuring and maintaining this site, with access to all member and activity data" + moderators: "Responsible for responding to flags, moderating discussions, and helping members with their accounts" + trust_level_0: "New members with limited abilities, who are learning community norms and functionality" + + trust_level_1: "Members with more trust, who have shown initial engagement by reading hand can now access more functions. All members of this group are also members of the trust_level_0 group." + + trust_level_2: "Active members who have consistently contributed overtime and gained full citizenship privileges. All members of this group are also members of the trust_level_1 and trust_level_0 groups." + + trust_level_3: "Highly engaged, long-term contributors, who form the backbone of the community and have gained limited moderation privileges. All members of this group are also members of the trust_level_2, trust_level_1 and trust_level_0 groups." + + trust_level_4: "Manually promoted members, recognized by their exemplary contributions and entrusted with additional moderation privileges. All members of this group are also members of the trust_level_3, trust_level_2, trust_level_1 and trust_level_0 groups." request_membership_pm: title: "Membership Request for @%{group_name}" request_accepted_pm: