Fix messages load stuck

This commit is contained in:
Tainan Felipe 2021-04-27 11:57:53 -03:00
parent 2e5c90bb35
commit 3ff065aa5c

View File

@ -24,11 +24,15 @@ export default function chatMessageBeforeJoinCounter() {
const User = Users.findOne({ userId: requesterUserId, meetingId }); const User = Users.findOne({ userId: requesterUserId, meetingId });
const chatIdWithCounter = groupChats.map((groupChat) => { 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 { return {
chatId: groupChat.chatId, chatId: groupChat.chatId,
count: msgCount, count: msgCount,
}; };
}).filter(chat => chat.count); }).filter((chat) => chat.count);
return chatIdWithCounter; return chatIdWithCounter;
} }