mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: #11717 prevent crash in messaging
This commit is contained in:
@@ -111,7 +111,7 @@ Messaging.getRecentChats = async (callerUid, uid, start, stop) => {
|
||||
teasers: Promise.all(roomIds.map(async roomId => Messaging.getTeaser(uid, roomId))),
|
||||
});
|
||||
|
||||
results.roomData.forEach((room, index) => {
|
||||
await Promise.all(results.roomData.map(async (room, index) => {
|
||||
if (room) {
|
||||
room.users = results.users[index];
|
||||
room.groupChat = room.hasOwnProperty('groupChat') ? room.groupChat : room.users.length > 2;
|
||||
@@ -125,12 +125,9 @@ Messaging.getRecentChats = async (callerUid, uid, start, stop) => {
|
||||
});
|
||||
room.users = room.users.filter(user => user && parseInt(user.uid, 10));
|
||||
room.lastUser = room.users[0];
|
||||
|
||||
room.usernames = Messaging.generateUsernames(room.users, uid);
|
||||
room.chatWithMessage = await Messaging.generateChatWithMessage(room.users, uid);
|
||||
}
|
||||
});
|
||||
await Promise.all(results.roomData.map(async (room) => {
|
||||
room.chatWithMessage = await Messaging.generateChatWithMessage(room.users, uid);
|
||||
}));
|
||||
|
||||
results.roomData = results.roomData.filter(Boolean);
|
||||
|
||||
Reference in New Issue
Block a user