send/receive user hashtags via AP (#4064)

This commit is contained in:
MeiMei 2019-01-31 20:42:45 +09:00 committed by syuilo
parent d140548784
commit a6e7bbc306
6 changed files with 29 additions and 14 deletions

View file

@ -8,6 +8,7 @@ import define from '../../define';
import getDriveFileUrl from '../../../../misc/get-drive-file-url';
import { parse, parsePlain } from '../../../../mfm/parse';
import extractEmojis from '../../../../misc/extract-emojis';
import extractHashtags from '../../../../misc/extract-hashtags';
const langmap = require('langmap');
export const meta = {
@ -201,9 +202,10 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => {
}
}
//#region emojis
//#region emojis/tags
if (updates.name != null || updates.description != null) {
let emojis = [] as string[];
let tags = [] as string[];
if (updates.name != null) {
const tokens = parsePlain(updates.name);
@ -213,9 +215,11 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => {
if (updates.description != null) {
const tokens = parse(updates.description);
emojis = emojis.concat(extractEmojis(tokens));
tags = extractHashtags(tokens);
}
updates.emojis = emojis;
updates.tags = tags;
}
//#endregion