mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: undefined object in notes.assert
This commit is contained in:
@@ -25,7 +25,7 @@ inbox.create = async (req) => {
|
||||
throw new Error('[[error:activitypub.not-implemented]]');
|
||||
}
|
||||
|
||||
const { tid, count } = await activitypub.notes.assert(0, object.id);
|
||||
const { tid, count } = await activitypub.notes.assert(0, object);
|
||||
winston.verbose(`[activitypub/inbox] Parsing ${count} notes into topic ${tid}`);
|
||||
};
|
||||
|
||||
@@ -129,7 +129,7 @@ inbox.announce = async (req) => {
|
||||
return;
|
||||
}
|
||||
|
||||
({ tid } = await activitypub.notes.assert(0, pid, object));
|
||||
({ tid } = await activitypub.notes.assert(0, pid));
|
||||
if (!tid) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,16 @@ const utils = require('../utils');
|
||||
const activitypub = module.parent.exports;
|
||||
const Notes = module.exports;
|
||||
|
||||
Notes.assert = async (uid, id, object) => {
|
||||
Notes.assert = async (uid, input) => {
|
||||
/**
|
||||
* Given the id (or optional AS object) of any post, traverses up to cache the entire threaded context
|
||||
* Given the id or object of any as:Note, traverses up to cache the entire threaded context
|
||||
*
|
||||
* Unfortunately, due to limitations and fragmentation of the existing ActivityPub landscape,
|
||||
* retrieving the entire reply tree is not possible at this time.
|
||||
*/
|
||||
|
||||
const chain = Array.from(await Notes.getParentChain(uid, object || id));
|
||||
const object = !activitypub.helpers.isUri(input) && input;
|
||||
const chain = Array.from(await Notes.getParentChain(uid, input));
|
||||
if (!chain.length) {
|
||||
return null;
|
||||
}
|
||||
@@ -127,7 +128,7 @@ Notes.assert = async (uid, id, object) => {
|
||||
]);
|
||||
|
||||
// Category announce
|
||||
if (id === post.pid) {
|
||||
if (object && object.id === post.pid) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
|
||||
Reference in New Issue
Block a user