refactor: ♻️ unessicary function
This commit is contained in:
parent
bbb2396d89
commit
d9274de0a7
3 changed files with 4 additions and 9 deletions
|
@ -90,7 +90,3 @@ export function decodeReaction(str: string): DecodedReaction {
|
|||
host: undefined,
|
||||
};
|
||||
}
|
||||
|
||||
export function convertToDecoded(reaction: string): string {
|
||||
return decodeReaction(reaction).reaction;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue