mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 18:16:17 +01:00
fix: tag handling when remote objects contain tags without leading # symbol
This commit is contained in:
@@ -162,8 +162,12 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
|||||||
const systemTags = (meta.config.systemTags || '').split(',');
|
const systemTags = (meta.config.systemTags || '').split(',');
|
||||||
const maxTags = await categories.getCategoryField(cid, 'maxTags');
|
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)))
|
.map((tag) => {
|
||||||
.map(o => o.name.slice(1));
|
tag.name = tag.name.startsWith('#') ? tag.name.slice(1) : tag.name;
|
||||||
|
return tag;
|
||||||
|
})
|
||||||
|
.filter(o => o.type === 'Hashtag' && !systemTags.includes(o.name))
|
||||||
|
.map(t => t.name);
|
||||||
|
|
||||||
if (tags.length > maxTags) {
|
if (tags.length > maxTags) {
|
||||||
tags.length = maxTags;
|
tags.length = maxTags;
|
||||||
|
|||||||
Reference in New Issue
Block a user