diff --git a/web/src/state_data.ts b/web/src/state_data.ts index 4093087393..33e53e600e 100644 --- a/web/src/state_data.ts +++ b/web/src/state_data.ts @@ -146,6 +146,7 @@ export const user_group_schema = z.object({ direct_subgroup_ids: z.array(z.number()), can_manage_group: z.number(), can_mention_group: z.number(), + deactivated: z.boolean(), }); export const user_topic_schema = z.object({ diff --git a/web/src/user_group_popover.ts b/web/src/user_group_popover.ts index bc18c6952f..893af31d20 100644 --- a/web/src/user_group_popover.ts +++ b/web/src/user_group_popover.ts @@ -101,6 +101,7 @@ export function toggle_user_group_info_popover( group_edit_url: hash_util.group_edit_url(group, "general"), is_guest: current_user.is_guest, is_system_group: group.is_system_group, + deactivated: group.deactivated, }; instance.setContent(ui_util.parse_html(render_user_group_info_popover(args))); }, diff --git a/web/src/user_groups.ts b/web/src/user_groups.ts index 92e0c0b279..e636b1032c 100644 --- a/web/src/user_groups.ts +++ b/web/src/user_groups.ts @@ -57,6 +57,7 @@ export function add(user_group_raw: UserGroupRaw): UserGroup { direct_subgroup_ids: new Set(user_group_raw.direct_subgroup_ids), can_manage_group: user_group_raw.can_manage_group, can_mention_group: user_group_raw.can_mention_group, + deactivated: user_group_raw.deactivated, }; user_group_name_dict.set(user_group.name, user_group); @@ -111,9 +112,19 @@ export function get_user_group_from_name(name: string): UserGroup | undefined { return user_group_name_dict.get(name); } -export function get_realm_user_groups(): UserGroup[] { +export function get_realm_user_groups(include_deactivated = false): UserGroup[] { const user_groups = [...user_group_by_id_dict.values()].sort((a, b) => a.id - b.id); - return user_groups.filter((group) => !group.is_system_group); + return user_groups.filter((group) => { + if (group.is_system_group) { + return false; + } + + if (!include_deactivated && group.deactivated) { + return false; + } + + return true; + }); } export function get_user_groups_allowed_to_mention(): UserGroup[] { diff --git a/web/templates/popovers/user_group_info_popover.hbs b/web/templates/popovers/user_group_info_popover.hbs index 1d76617ea2..bdc989fc66 100644 --- a/web/templates/popovers/user_group_info_popover.hbs +++ b/web/templates/popovers/user_group_info_popover.hbs @@ -9,6 +9,11 @@
{{group_description}}
+ {{#if deactivated}} +
  • + {{t "This group has been deactivated." }} +
  • + {{/if}}
  • {{#if members.length}} @@ -28,7 +33,7 @@ {{t 'This group has no members.'}} {{/if}}
  • - {{#unless (or is_guest is_system_group)}} + {{#unless (or is_guest is_system_group deactivated)}}