mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: tweak maxTags handling
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user