mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: return count of new notes in assertTopic
This commit is contained in:
@@ -26,8 +26,8 @@ inbox.create = async (req) => {
|
|||||||
throw new Error('[[error:activitypub.not-implemented]]');
|
throw new Error('[[error:activitypub.not-implemented]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
const tid = await activitypub.notes.assertTopic(0, object.id);
|
const { tid, count } = await activitypub.notes.assertTopic(0, object.id);
|
||||||
winston.verbose(`[activitypub/inbox] Parsing note ${object.id} into topic ${tid}`);
|
winston.verbose(`[activitypub/inbox] Parsing ${count} notes into topic ${tid}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
inbox.update = async (req) => {
|
inbox.update = async (req) => {
|
||||||
@@ -125,7 +125,7 @@ inbox.announce = async (req) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tid = await activitypub.notes.assertTopic(0, pid);
|
({ tid } = await activitypub.notes.assertTopic(0, pid));
|
||||||
if (!tid) {
|
if (!tid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,7 +245,8 @@ Notes.assertTopic = async (uid, id) => {
|
|||||||
post.tid = tid; // add tid to post hash
|
post.tid = tid; // add tid to post hash
|
||||||
return post;
|
return post;
|
||||||
}).filter((p, idx) => !members[idx]);
|
}).filter((p, idx) => !members[idx]);
|
||||||
winston.verbose(`[notes/assertTopic] ${unprocessed.length} new note(s) found.`);
|
const count = unprocessed.length;
|
||||||
|
winston.verbose(`[notes/assertTopic] ${count} new note(s) found.`);
|
||||||
|
|
||||||
const [ids, timestamps] = [
|
const [ids, timestamps] = [
|
||||||
unprocessed.map(n => (utils.isNumber(n.pid) ? parseInt(n.pid, 10) : n.pid)),
|
unprocessed.map(n => (utils.isNumber(n.pid) ? parseInt(n.pid, 10) : n.pid)),
|
||||||
@@ -287,7 +288,7 @@ Notes.assertTopic = async (uid, id) => {
|
|||||||
|
|
||||||
await Notes.syncUserInboxes(tid);
|
await Notes.syncUserInboxes(tid);
|
||||||
|
|
||||||
return tid;
|
return { tid, count };
|
||||||
};
|
};
|
||||||
|
|
||||||
Notes.syncUserInboxes = async function (tid) {
|
Notes.syncUserInboxes = async function (tid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user