Node.js based forum software built for the modern web
fix: filter out system tags and prune extra tags beyond number allowed, when creating topic from remote data
Julian Lam7aa56c727b0c
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.jsindex 10d35ca80a..8b9318b08e 100644--- a/src/activitypub/notes.js+++ b/src/activitypub/notes.js@@ -6,6 +6,7 @@ const crypto = require('crypto');const db = require('../database');const meta = require('../meta');const privileges = require('../privileges');+const categories = require('../categories');const user = require('../user');const topics = require('../topics');const posts = require('../posts');@@ -192,10 +193,16 @@ Notes.assertTopic = async (uid, id) => {let tags;if (!hasTid) {+ const systemTags = (meta.config.systemTags || '').split(',');+ const maxTags = cid > 0 ? await categories.getCategoryField(cid, 'maxTags') : null;tags = (mainPost._activitypub.tag || [])- .filter(o => o.type === 'Hashtag')+ .filter(o => o.type === 'Hashtag' && !systemTags.include(o.name.slice(1))).map(o => o.name.slice(1));+ if (maxTags) {+ tags.length = maxTags;+ }+await topics.post({tid,uid: authorId,