Skip to content

Node.js based forum software built for the modern web

fix: if the topic already existed in -1, move it to another category if one was passed in options

Julian Lam49a64dc7a790
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js
index 9a2196e39a..6006a374ba 100644
--- a/src/activitypub/notes.js
+++ b/src/activitypub/notes.js
@@ -63,6 +63,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
let title;
if (hasTid) {
({ cid, mainPid } = await topics.getTopicFields(tid, ['tid', 'cid', 'mainPid']));
+
+ if (options.cid && cid === -1) {
+ // Move topic
+ await topics.tools.move(tid, { cid: options.cid, uid: 0 });
+ }
} else {
// mainPid ok to leave as-is
cid = options.cid || -1;