Skip to content
Snippets Groups Projects
Unverified Commit 916512fd authored by MeiMei's avatar MeiMei Committed by GitHub
Browse files

同じリアクション削除を同時に行うとリアクションカウントがおかしくなることがあるのを修正 (#6253)

* Fix #6252

* quote

* Use IdentifiableError
parent 58d3a379
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,11 @@ export default async (user: User, note: Note) => {
}
// 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
const sql = `jsonb_set("reactions", '{${exist.reaction}}', (COALESCE("reactions"->>'${exist.reaction}', '0')::int - 1)::text::jsonb)`;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment