mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-23 04:33:50 +01:00
同じリアクション削除を同時に行うとリアクションカウントがおかしくなることがあるのを修正 (#6253)
* Fix #6252 * quote * Use IdentifiableError
This commit is contained in:
parent
ae5a8e776e
commit
ec5a1c8a9d
@ -20,7 +20,11 @@ export default async (user: User, note: Note) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete reaction
|
// Delete reaction
|
||||||
await NoteReactions.delete(exist.id);
|
const result = await NoteReactions.delete(exist.id);
|
||||||
|
|
||||||
|
if (result.affected !== 1) {
|
||||||
|
throw new IdentifiableError('60527ec9-b4cb-4a88-a6bd-32d3ad26817d', 'not reacted');
|
||||||
|
}
|
||||||
|
|
||||||
// Decrement reactions count
|
// Decrement reactions count
|
||||||
const sql = `jsonb_set("reactions", '{${exist.reaction}}', (COALESCE("reactions"->>'${exist.reaction}', '0')::int - 1)::text::jsonb)`;
|
const sql = `jsonb_set("reactions", '{${exist.reaction}}', (COALESCE("reactions"->>'${exist.reaction}', '0')::int - 1)::text::jsonb)`;
|
||||||
|
Loading…
Reference in New Issue
Block a user