Skip to content

Node.js based forum software built for the modern web

fix: tweak maxTags handling

Julian Lamccd9c7ed85c0
diff --git a/src/activitypub/notes.js b/src/activitypub/notes.js
index 8716a7945a..a2906c40d0 100644
--- a/src/activitypub/notes.js
+++ b/src/activitypub/notes.js
@@ -194,12 +194,12 @@ 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;
+ const maxTags = await categories.getCategoryField(cid, 'maxTags');
tags = (mainPost._activitypub.tag || [])
.filter(o => o.type === 'Hashtag' && !systemTags.includes(o.name.slice(1)))
.map(o => o.name.slice(1));
- if (maxTags) {
+ if (maxTags && tags.length > maxTags) {
tags.length = maxTags;
}