fix: update auto-categorization rules to also handle already-categorized topics via crosspost

This commit is contained in:
Julian Lam
2025-12-29 14:57:47 -05:00
parent f6cc556d37
commit 148663c536
2 changed files with 10 additions and 3 deletions

View File

@@ -104,6 +104,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
const hasTid = !!tid;
const cid = hasTid ? await topics.getTopicField(tid, 'cid') : options.cid || -1;
let crosspostCid = false;
if (options.cid && cid === -1) {
// Move topic if currently uncategorized
@@ -155,8 +156,10 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
}
// Auto-categorization (takes place only if all other categorization efforts fail)
crosspostCid = await assignCategory(mainPost);
if (!options.cid) {
options.cid = await assignCategory(mainPost);
options.cid = crosspostCid;
crosspostCid = false;
}
// mainPid ok to leave as-is
@@ -265,6 +268,10 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
await Notes.syncUserInboxes(tid, uid);
if (crosspostCid) {
await topics.crossposts.add(tid, crosspostCid, 0);
}
if (!hasTid && uid && options.cid) {
// New topic, have category announce it
await activitypub.out.announce.topic(tid);