Skip to content

Commit 62157b1

Browse files
claude[bot]Trigger.dev RepoOps
authored andcommitted
fix(webapp): sort active team members alphabetically
The active team members list in organization settings is now sorted alphabetically instead of appearing in an arbitrary order. Members are sorted case-insensitively by their display name, falling back to their email address when no name is set. The pending invites list on the same page is now sorted alphabetically by email too. Mono-RevId: 38df496ffef4cf31f8956c4c3cd38387e06e4519
1 parent d8c3530 commit 62157b1

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: fix
4+
---
5+
6+
Team members and pending invites on the organization Team page are now listed in alphabetical order.

‎apps/webapp/app/models/member.server.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,17 @@ export async function getTeamMembersAndInvites({
101101
return null;
102102
}
103103

104-
return { members: org.members, invites: org.invites };
104+
// Prisma can't express "order by name, falling back to email when unset"
105+
// case-insensitively in a single nested orderBy, so sort in JS here.
106+
const byDisplayName = (a: string, b: string) =>
107+
a.localeCompare(b, undefined, { sensitivity: "base" });
108+
109+
const members = [...org.members].sort((a, b) =>
110+
byDisplayName(a.user.name ?? a.user.email, b.user.name ?? b.user.email)
111+
);
112+
const invites = [...org.invites].sort((a, b) => byDisplayName(a.email, b.email));
113+
114+
return { members, invites };
105115
}
106116

107117
export async function inviteMembers({

0 commit comments

Comments
 (0)