fix: 🐛 properly decode reaction
This commit is contained in:
parent
238f80ae02
commit
baba9b068b
@ -3,6 +3,7 @@ import { NoteReaction } from "@/models/entities/note-reaction.js";
|
||||
import { Notes, Users } from "../index.js";
|
||||
import type { Packed } from "@/misc/schema.js";
|
||||
import type { User } from "@/models/entities/user.js";
|
||||
import { decodeReaction } from "@/misc/reaction-lib.js";
|
||||
|
||||
export const NoteReactionRepository = db.getRepository(NoteReaction).extend({
|
||||
async pack(
|
||||
@ -26,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: reaction.reaction,
|
||||
type: decodeReaction(reaction.reaction).reaction,
|
||||
...(opts.withNote
|
||||
? {
|
||||
note: await Notes.pack(reaction.note ?? reaction.noteId, me),
|
||||
|
@ -73,7 +73,7 @@ async function populateMyReaction(
|
||||
if (_hint_?.myReactions) {
|
||||
const reaction = _hint_.myReactions.get(note.id);
|
||||
if (reaction) {
|
||||
return reaction.reaction;
|
||||
return decodeReaction(reaction.reaction).reaction;
|
||||
} else if (reaction === null) {
|
||||
return undefined;
|
||||
}
|
||||
@ -86,7 +86,7 @@ async function populateMyReaction(
|
||||
});
|
||||
|
||||
if (reaction) {
|
||||
return reaction.reaction;
|
||||
return decodeReaction(reaction.reaction).reaction;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@ -103,7 +103,7 @@ export const NoteRepository = db.getRepository(Note).extend({
|
||||
return true;
|
||||
} else {
|
||||
// 指定されているかどうか
|
||||
return note.visibleUserIds.some((id: string) => meId === id);
|
||||
return note.visibleUserIds.some((id: any) => meId === id);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user