mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-14 10:05:46 +01:00
Apply tag length limit from AP (#3536)
This commit is contained in:
parent
96571866a3
commit
702875a78e
1 changed files with 2 additions and 3 deletions
|
@ -161,6 +161,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
||||||
const combinedTokens = tokens.concat(cwTokens);
|
const combinedTokens = tokens.concat(cwTokens);
|
||||||
|
|
||||||
tags = data.apHashtags || extractHashtags(combinedTokens);
|
tags = data.apHashtags || extractHashtags(combinedTokens);
|
||||||
|
tags = tags.filter(tag => tag.length <= 100);
|
||||||
|
|
||||||
emojis = data.apEmojis || extractEmojis(combinedTokens);
|
emojis = data.apEmojis || extractEmojis(combinedTokens);
|
||||||
|
|
||||||
|
@ -467,9 +468,7 @@ function extractHashtags(tokens: ReturnType<typeof parse>): string[] {
|
||||||
|
|
||||||
const extract = (tokens: Node[]) => {
|
const extract = (tokens: Node[]) => {
|
||||||
tokens.filter(x => x.name === 'hashtag').forEach(x => {
|
tokens.filter(x => x.name === 'hashtag').forEach(x => {
|
||||||
if (x.props.hashtag.length <= 100) {
|
hashtags.push(x.props.hashtag);
|
||||||
hashtags.push(x.props.hashtag);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
tokens.filter(x => x.children).forEach(x => {
|
tokens.filter(x => x.children).forEach(x => {
|
||||||
extract(x.children);
|
extract(x.children);
|
||||||
|
|
Loading…
Reference in a new issue