mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: add try..catch around topics.post in note assertion logic
This commit is contained in:
@@ -196,8 +196,8 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
const { to, cc, attachment } = mainPost._activitypub;
|
const { to, cc, attachment } = mainPost._activitypub;
|
||||||
const tags = await Notes._normalizeTags(mainPost._activitypub.tag || []);
|
const tags = await Notes._normalizeTags(mainPost._activitypub.tag || []);
|
||||||
|
|
||||||
await Promise.all([
|
try {
|
||||||
topics.post({
|
await topics.post({
|
||||||
tid,
|
tid,
|
||||||
uid: authorId,
|
uid: authorId,
|
||||||
cid: options.cid || cid,
|
cid: options.cid || cid,
|
||||||
@@ -208,13 +208,16 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
content: mainPost.content,
|
content: mainPost.content,
|
||||||
sourceContent: mainPost.sourceContent,
|
sourceContent: mainPost.sourceContent,
|
||||||
_activitypub: mainPost._activitypub,
|
_activitypub: mainPost._activitypub,
|
||||||
}),
|
});
|
||||||
Notes.updateLocalRecipients(mainPid, { to, cc }),
|
|
||||||
]);
|
|
||||||
unprocessed.shift();
|
unprocessed.shift();
|
||||||
|
} catch (e) {
|
||||||
|
activitypub.helpers.log(`[activitypub/notes.assert] Could not post topic (${mainPost.pid}): ${e.message}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// These must come after topic is posted
|
// These must come after topic is posted
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
Notes.updateLocalRecipients(mainPid, { to, cc }),
|
||||||
mainPost._activitypub.image ? topics.thumbs.associate({
|
mainPost._activitypub.image ? topics.thumbs.associate({
|
||||||
id: tid,
|
id: tid,
|
||||||
path: mainPost._activitypub.image,
|
path: mainPost._activitypub.image,
|
||||||
|
|||||||
Reference in New Issue
Block a user