From 2af028c1d512597fd626589f4142f530d394f1a1 Mon Sep 17 00:00:00 2001 From: mei23 Date: Sat, 8 Dec 2018 05:41:14 +0900 Subject: [PATCH] Use MFM parser for extracting emoji in name --- src/server/api/endpoints/i/update.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts index 0319550109..fbf1dc32e1 100644 --- a/src/server/api/endpoints/i/update.ts +++ b/src/server/api/endpoints/i/update.ts @@ -198,8 +198,8 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => { let emojis = [] as string[]; if (updates.name != null) { - const match = updates.name.match(/:\w{1,100}:/g) as string[]; - if (match) emojis = emojis.concat(match.map(m => m.replace(/:(\w+):/, '$1'))); + const tokens = parse(updates.name, true); + emojis = emojis.concat(extractEmojis(tokens)); } if (updates.description != null) {