Skip to content
Snippets Groups Projects
Unverified Commit 063de7d7 authored by Luciano Marcos Pierdona Junior's avatar Luciano Marcos Pierdona Junior Committed by GitHub
Browse files

[FIX] Active users count on `@all` and `@here` (#25957)

parent 5f20d50c
No related branches found
No related tags found
No related merge requests found
...@@ -244,7 +244,7 @@ export async function sendMessageNotifications(message, room, usersInThread = [] ...@@ -244,7 +244,7 @@ export async function sendMessageNotifications(message, room, usersInThread = []
// Don't fetch all users if room exceeds max members // Don't fetch all users if room exceeds max members
const maxMembersForNotification = settings.get('Notifications_Max_Room_Members'); const maxMembersForNotification = settings.get('Notifications_Max_Room_Members');
const roomMembersCount = Subscriptions.findByRoomId(room._id).count(); const roomMembersCount = await Users.countRoomMembers(room._id);
const disableAllMessageNotifications = roomMembersCount > maxMembersForNotification && maxMembersForNotification !== 0; const disableAllMessageNotifications = roomMembersCount > maxMembersForNotification && maxMembersForNotification !== 0;
const query = { const query = {
......
...@@ -1655,6 +1655,10 @@ Find users to send a message by email if: ...@@ -1655,6 +1655,10 @@ Find users to send a message by email if:
}, },
}); });
} }
countRoomMembers(roomId) {
return this.find({ __rooms: roomId, active: true }).count();
}
} }
export default new Users(Meteor.users, true); export default new Users(Meteor.users, true);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment