summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/ReactionService.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-09-24 18:29:02 +0900
committerGitHub <noreply@github.com>2024-09-24 18:29:02 +0900
commit6a1a2bef43af929f6def408428bd734ea2bff5c6 (patch)
tree65e843100f1d004c9f7986fd38319924f4cb6a65 /packages/backend/src/core/ReactionService.ts
parent:art: (diff)
downloadmisskey-6a1a2bef43af929f6def408428bd734ea2bff5c6.tar.gz
misskey-6a1a2bef43af929f6def408428bd734ea2bff5c6.tar.bz2
misskey-6a1a2bef43af929f6def408428bd734ea2bff5c6.zip
fix(backend): RBTの修正 (#14621)
* fix(backend): 絵文字の変換処理が不十分なのを修正 * enhance: リアクションバッファリングが無効になったら即bakeするように * attempt to fix test * fix
Diffstat (limited to 'packages/backend/src/core/ReactionService.ts')
-rw-r--r--packages/backend/src/core/ReactionService.ts28
1 files changed, 15 insertions, 13 deletions
diff --git a/packages/backend/src/core/ReactionService.ts b/packages/backend/src/core/ReactionService.ts
index 062d64f46b..6f9fe53937 100644
--- a/packages/backend/src/core/ReactionService.ts
+++ b/packages/backend/src/core/ReactionService.ts
@@ -337,10 +337,22 @@ export class ReactionService {
//#endregion
}
+ /**
+ * - 文字列タイプのレガシーな形式のリアクションを現在の形式に変換する
+ * - ローカルのリアクションのホストを `@.` にする(`decodeReaction()`の効果)
+ */
+ @bindThis
+ public convertLegacyReaction(reaction: string): string {
+ reaction = this.decodeReaction(reaction).reaction;
+ if (Object.keys(legacies).includes(reaction)) return legacies[reaction];
+ return reaction;
+ }
+
// TODO: 廃止
/**
- * 文字列タイプのレガシーな形式のリアクションを現在の形式に変換しつつ、
- * データベース上には存在する「0個のリアクションがついている」という情報を削除する。
+ * - 文字列タイプのレガシーな形式のリアクションを現在の形式に変換する
+ * - ローカルのリアクションのホストを `@.` にする(`decodeReaction()`の効果)
+ * - データベース上には存在する「0個のリアクションがついている」という情報を削除する
*/
@bindThis
public convertLegacyReactions(reactions: MiNote['reactions']): MiNote['reactions'] {
@@ -353,10 +365,7 @@ export class ReactionService {
return count > 0;
})
.map(([reaction, count]) => {
- // unchecked indexed access
- const convertedReaction = legacies[reaction] as string | undefined;
-
- const key = this.decodeReaction(convertedReaction ?? reaction).reaction;
+ const key = this.convertLegacyReaction(reaction);
return [key, count] as const;
})
@@ -411,11 +420,4 @@ export class ReactionService {
host: undefined,
};
}
-
- @bindThis
- public convertLegacyReaction(reaction: string): string {
- reaction = this.decodeReaction(reaction).reaction;
- if (Object.keys(legacies).includes(reaction)) return legacies[reaction];
- return reaction;
- }
}