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

This commit is contained in:
Julian Lam
2024-04-16 14:17:47 -04:00
parent 452cb0a9aa
commit 49a64dc7a7

View File

@@ -63,6 +63,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
let title; let title;
if (hasTid) { if (hasTid) {
({ cid, mainPid } = await topics.getTopicFields(tid, ['tid', 'cid', 'mainPid'])); ({ 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 { } else {
// mainPid ok to leave as-is // mainPid ok to leave as-is
cid = options.cid || -1; cid = options.cid || -1;