From e184c1cdfbe757d4a14b4a94ed3ecb4800098f78 Mon Sep 17 00:00:00 2001
From: Xeltica <7106976+Xeltica@users.noreply.github.com>
Date: Sat, 18 Apr 2020 12:06:44 +0900
Subject: [PATCH] =?UTF-8?q?=E3=82=AB=E3=82=B9=E3=82=BF=E3=83=A0=E7=B5=B5?=
 =?UTF-8?q?=E6=96=87=E5=AD=97=E3=83=AA=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7?=
 =?UTF-8?q?=E3=83=B3=E3=81=8C=E3=83=97=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?=
 =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E4=B8=8D=E5=85=B7=E5=90=88?=
 =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=20fix=20#6272=20(#6273)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* カスタム絵文字リアクションがプレビューされない不具合を修正

* add comments
---
 src/server/api/endpoints/notes/reactions.ts | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/server/api/endpoints/notes/reactions.ts b/src/server/api/endpoints/notes/reactions.ts
index 4874c85b67..2621e2a12f 100644
--- a/src/server/api/endpoints/notes/reactions.ts
+++ b/src/server/api/endpoints/notes/reactions.ts
@@ -79,7 +79,11 @@ export default define(meta, async (ps, user) => {
 	} as DeepPartial<NoteReaction>;
 
 	if (ps.type) {
-		query.reaction = ps.type;
+		// ローカルリアクションはホスト名が . とされているが
+		// DB 上ではそうではないので、必要に応じて変換
+		const suffix = '@.:';
+		const type = ps.type.endsWith(suffix) ? ps.type.slice(0, ps.type.length - suffix.length) + ':' : ps.type;
+		query.reaction = type;
 	}
 
 	const reactions = await NoteReactions.find({
-- 
GitLab