Skip to content

Commit 5932a66

Browse files
committed
add new fields on getUserFromParams
1 parent b529fa0 commit 5932a66

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/meteor/app/api/server/helpers/getUserFromParams.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ export async function getUserFromParams<T extends boolean = false>(
1010
user?: string;
1111
},
1212
full?: T,
13-
): Promise<T extends true ? IUser : Pick<IUser, '_id' | 'username' | 'name' | 'status' | 'statusText' | 'roles'>> {
13+
): Promise<
14+
T extends true
15+
? IUser
16+
: Pick<IUser, '_id' | 'username' | 'name' | 'status' | 'statusText' | 'statusSource' | 'statusEmoji' | 'statusExpiresAt' | 'roles'>
17+
> {
1418
let user;
1519

16-
const projection = full ? {} : { username: 1, name: 1, status: 1, statusText: 1, roles: 1 };
20+
const projection = full
21+
? {}
22+
: { username: 1, name: 1, status: 1, statusText: 1, statusSource: 1, statusEmoji: 1, statusExpiresAt: 1, roles: 1 };
1723
if (params.userId?.trim()) {
1824
user = await Users.findOneById(params.userId, { projection });
1925
} else if (params.username?.trim()) {

0 commit comments

Comments
 (0)