diff --git a/apps/meteor/app/api/server/v1/channels.ts b/apps/meteor/app/api/server/v1/channels.ts index 91c7b63c2098..7e2fea773e1d 100644 --- a/apps/meteor/app/api/server/v1/channels.ts +++ b/apps/meteor/app/api/server/v1/channels.ts @@ -1082,6 +1082,8 @@ API.v1.addRoute( const [members, total] = await Promise.all([cursor.toArray(), totalCount]); + members.sort((a, b) => (a.username ?? "").localeCompare(b.username ?? "")); + return API.v1.success({ members, count: members.length, diff --git a/apps/meteor/app/api/server/v1/groups.ts b/apps/meteor/app/api/server/v1/groups.ts index 1a8069fff205..b990eff3b16a 100644 --- a/apps/meteor/app/api/server/v1/groups.ts +++ b/apps/meteor/app/api/server/v1/groups.ts @@ -733,6 +733,7 @@ API.v1.addRoute( }); const [members, total] = await Promise.all([cursor.toArray(), totalCount]); + members.sort((a, b) => (a.username ?? "").localeCompare(b.username ?? "")); return API.v1.success({ members, diff --git a/apps/meteor/app/api/server/v1/im.ts b/apps/meteor/app/api/server/v1/im.ts index d74d3decfbab..673246dd6d35 100644 --- a/apps/meteor/app/api/server/v1/im.ts +++ b/apps/meteor/app/api/server/v1/im.ts @@ -359,6 +359,7 @@ API.v1.addRoute( const { cursor, totalCount } = Users.findPaginatedByActiveUsersExcept(filter, [], options, searchFields, [extraQuery]); const [members, total] = await Promise.all([cursor.toArray(), totalCount]); + members.sort((a, b) => (a.username ?? "").localeCompare(b.username ?? "")); return API.v1.success({ members,