allow caller to pass in existing reaction hint to ReactionService.delete

This commit is contained in:
Hazelnoot 2025-05-11 00:05:52 -04:00
parent fe5def9de0
commit a8a8c41a9b

View file

@ -298,9 +298,9 @@ export class ReactionService {
} }
@bindThis @bindThis
public async delete(user: { id: MiUser['id']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote) { public async delete(user: { id: MiUser['id']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote, exist?: MiNoteReaction | null) {
// if already unreacted // if already unreacted
const exist = await this.noteReactionsRepository.findOneBy({ exist ??= await this.noteReactionsRepository.findOneBy({
noteId: note.id, noteId: note.id,
userId: user.id, userId: user.id,
}); });