Skip to content

Commit

Permalink
minor code refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinav Kumar <[email protected]>
  • Loading branch information
abhinavkrin committed Dec 18, 2024
1 parent e476a01 commit 74f786c
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions apps/meteor/server/lib/findUsersOfRoomOrderedByRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,36 @@ export async function findUsersOfRoomOrderedByRole({
userLookupPipeline.push({ $match: { status } });
}

userLookupPipeline.push({
$match: {
$and: [
{
active: true,
username: {
$exists: true,
...(exceptions.length > 0 && { $nin: exceptions }),
userLookupPipeline.push(
{
$match: {
$and: [
{
active: true,
username: {
$exists: true,
...(exceptions.length > 0 && { $nin: exceptions }),
},
...(filter && orStmt.length > 0 && { $or: orStmt }),
},
...(filter && orStmt.length > 0 && { $or: orStmt }),
},
...extraQuery,
],
...extraQuery,
],
},
},
});

userLookupPipeline.push({
$project: {
_id: 1,
username: 1,
name: 1,
nickname: 1,
status: 1,
avatarETag: 1,
_updatedAt: 1,
federated: 1,
statusConnection: 1,
{
$project: {
_id: 1,
username: 1,
name: 1,
nickname: 1,
status: 1,
avatarETag: 1,
_updatedAt: 1,
federated: 1,
statusConnection: 1,
},
},
});
);

const defaultPriority = rolesInOrder.length + 1;

Expand Down

0 comments on commit 74f786c

Please sign in to comment.