diff --git a/bigbluebutton-html5/imports/api/group-chat-msg/server/methods/chatMessageBeforeJoinCounter.js b/bigbluebutton-html5/imports/api/group-chat-msg/server/methods/chatMessageBeforeJoinCounter.js index 175eee0cdbfb1939296dda1a2ec59b4228edb77c..5f502a9d3352f11b6e2c3aebfc02e892d0025cd6 100644 --- a/bigbluebutton-html5/imports/api/group-chat-msg/server/methods/chatMessageBeforeJoinCounter.js +++ b/bigbluebutton-html5/imports/api/group-chat-msg/server/methods/chatMessageBeforeJoinCounter.js @@ -24,11 +24,15 @@ export default function chatMessageBeforeJoinCounter() { const User = Users.findOne({ userId: requesterUserId, meetingId }); const chatIdWithCounter = groupChats.map((groupChat) => { - const msgCount = GroupChatMsg.find({ chatId: groupChat.chatId, timestamp: { $lt: User.authTokenValidatedTime } }).count(); + const msgCount = GroupChatMsg.find({ + meetingId, + chatId: groupChat.chatId, + timestamp: { $lt: User.authTokenValidatedTime }, + }).count(); return { chatId: groupChat.chatId, count: msgCount, }; - }).filter(chat => chat.count); + }).filter((chat) => chat.count); return chatIdWithCounter; }