diff --git a/packages/backend/src/misc/reaction-lib.ts b/packages/backend/src/misc/reaction-lib.ts index 1748bcee1..129549505 100644 --- a/packages/backend/src/misc/reaction-lib.ts +++ b/packages/backend/src/misc/reaction-lib.ts @@ -90,7 +90,3 @@ export function decodeReaction(str: string): DecodedReaction { host: undefined, }; } - -export function convertToDecoded(reaction: string): string { - return decodeReaction(reaction).reaction; -} diff --git a/packages/backend/src/models/repositories/note-reaction.ts b/packages/backend/src/models/repositories/note-reaction.ts index ea04f0331..4075c7d43 100644 --- a/packages/backend/src/models/repositories/note-reaction.ts +++ b/packages/backend/src/models/repositories/note-reaction.ts @@ -2,7 +2,7 @@ import { db } from "@/db/postgre.js"; import { NoteReaction } from "@/models/entities/note-reaction.js"; import { Notes, Users } from "../index.js"; import type { Packed } from "@/misc/schema.js"; -import { convertToDecoded } from "@/misc/reaction-lib.js"; +import { decodeReaction } from "@/misc/reaction-lib.js"; import type { User } from "@/models/entities/user.js"; export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ @@ -27,7 +27,7 @@ export const NoteReactionRepository = db.getRepository(NoteReaction).extend({ id: reaction.id, createdAt: reaction.createdAt.toISOString(), user: await Users.pack(reaction.user ?? reaction.userId, me), - type: convertToDecoded(reaction.reaction), + type: decodeReaction(reaction.reaction).reaction, ...(opts.withNote ? { // may throw error diff --git a/packages/backend/src/models/repositories/note.ts b/packages/backend/src/models/repositories/note.ts index 8d8df6254..f4229eaa8 100644 --- a/packages/backend/src/models/repositories/note.ts +++ b/packages/backend/src/models/repositories/note.ts @@ -15,7 +15,6 @@ import type { Packed } from "@/misc/schema.js"; import { nyaize } from "@/misc/nyaize.js"; import { awaitAll } from "@/prelude/await-all.js"; import { - convertToDecoded, convertReactions, decodeReaction, } from "@/misc/reaction-lib.js"; @@ -77,7 +76,7 @@ async function populateMyReaction( if (_hint_?.myReactions) { const reaction = _hint_.myReactions.get(note.id); if (reaction) { - return convertToDecoded(reaction.reaction); + return decodeReaction(reaction.reaction).reaction; } else if (reaction === null) { return undefined; } @@ -90,7 +89,7 @@ async function populateMyReaction( }); if (reaction) { - return convertToDecoded(reaction.reaction); + return decodeReaction(reaction.reaction).reaction; } return undefined;