mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 03:55:55 +01:00
fix: handle inaccessible boosts
This commit is contained in:
@@ -98,6 +98,10 @@ inbox.announce = async (req) => {
|
|||||||
} else {
|
} else {
|
||||||
pid = object;
|
pid = object;
|
||||||
tid = await activitypub.notes.assertTopic(0, object);
|
tid = await activitypub.notes.assertTopic(0, object);
|
||||||
|
if (!tid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await topics.updateLastPostTime(tid, timestamp);
|
await topics.updateLastPostTime(tid, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ Notes.getParentChain = async (uid, input) => {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
winston.warn(`[activitypub/notes/getParentChain] Cannot retrieve ${id}, terminating here.`);
|
winston.warn(`[activitypub/notes/getParentChain] Cannot retrieve ${id}, terminating here.`);
|
||||||
chain.delete(id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -153,6 +152,10 @@ Notes.assertTopic = async (uid, id) => {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const chain = Array.from(await Notes.getParentChain(uid, id));
|
const chain = Array.from(await Notes.getParentChain(uid, id));
|
||||||
|
if (!chain.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
let { pid: mainPid, tid, uid: authorId, timestamp, name, content } = chain[chain.length - 1];
|
let { pid: mainPid, tid, uid: authorId, timestamp, name, content } = chain[chain.length - 1];
|
||||||
const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.map(p => p.pid));
|
const members = await db.isSortedSetMembers(`tid:${tid}:posts`, chain.map(p => p.pid));
|
||||||
if (tid && members.every(Boolean)) {
|
if (tid && members.every(Boolean)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user