mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
fix: filter undefined posts/topics
This commit is contained in:
@@ -111,7 +111,9 @@ async function sendNotifications(uids, topicsData) {
|
||||
const userData = await user.getUsersData(uids);
|
||||
const uidToUserData = Object.fromEntries(uids.map((uid, idx) => [uid, userData[idx]]));
|
||||
|
||||
const postsData = await posts.getPostsData(topicsData.map(t => t && t.mainPid));
|
||||
let postsData = await posts.getPostsData(topicsData.map(t => t && t.mainPid));
|
||||
topicsData = topicsData.filter((t, i) => t && postsData[i]);
|
||||
postsData = postsData.filter(Boolean);
|
||||
postsData.forEach((postData, idx) => {
|
||||
if (postData) {
|
||||
postData.user = uidToUserData[topicsData[idx].uid];
|
||||
|
||||
Reference in New Issue
Block a user