From f5d4926bc1f5b81199770ce349c67b086d3ef69d Mon Sep 17 00:00:00 2001 From: George K Date: Thu, 29 Jan 2026 08:33:02 -0800 Subject: [PATCH] fix(site): use total_member_count for group subtitles when sharing (#21744) Justification: - Populating `members` is authorized with `group_member.read` which is not required to be able to share a workspace - Populating `total_member_count` is authorized with `group.read` which is required to be able to share - The updated helper is only used in template/workspace sharing UIs, so other pages that might need counts of readable members are unaffected Related to: https://github.com/coder/internal/issues/1302 --- site/src/modules/groups.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/site/src/modules/groups.ts b/site/src/modules/groups.ts index d385786c44..24accf4604 100644 --- a/site/src/modules/groups.ts +++ b/site/src/modules/groups.ts @@ -41,13 +41,11 @@ export const getGroupSubtitle = (group: Group): string => { return "All users"; } - if (!group.members) { - return "0 members"; - } + const total = group.total_member_count ?? group.members?.length ?? 0; - if (group.members.length === 1) { + if (total === 1) { return "1 member"; } - return `${group.members.length} members`; + return `${total} members`; };