fix: tweak maxTags handling

This commit is contained in:
Julian Lam
2024-03-14 14:48:35 -04:00
parent ff6cc90ca5
commit ccd9c7ed85

View File

@@ -194,12 +194,12 @@ Notes.assertTopic = async (uid, id) => {
let tags; let tags;
if (!hasTid) { if (!hasTid) {
const systemTags = (meta.config.systemTags || '').split(','); 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 || []) tags = (mainPost._activitypub.tag || [])
.filter(o => o.type === 'Hashtag' && !systemTags.includes(o.name.slice(1))) .filter(o => o.type === 'Hashtag' && !systemTags.includes(o.name.slice(1)))
.map(o => o.name.slice(1)); .map(o => o.name.slice(1));
if (maxTags) { if (maxTags && tags.length > maxTags) {
tags.length = maxTags; tags.length = maxTags;
} }