Allow un-rejecting events on reprocessing

This commit is contained in:
Neil Alexander 2022-08-24 14:03:06 +01:00
parent 78e5d05efc
commit 522bd2999f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 11 additions and 3 deletions

View file

@ -74,7 +74,7 @@ const insertEventSQL = "" +
"INSERT INTO roomserver_events AS e (room_nid, event_type_nid, event_state_key_nid, event_id, reference_sha256, auth_event_nids, depth, is_rejected)" +
" VALUES ($1, $2, $3, $4, $5, $6, $7, $8)" +
" ON CONFLICT ON CONSTRAINT roomserver_event_id_unique DO UPDATE" +
" SET is_rejected = $8 WHERE e.event_id = $4 AND e.is_rejected = FALSE" +
" SET is_rejected = $8 WHERE e.event_id = $4 AND e.is_rejected = TRUE" +
" RETURNING event_nid, state_snapshot_nid"
const selectEventSQL = "" +

View file

@ -50,7 +50,7 @@ const insertEventSQL = `
INSERT INTO roomserver_events (room_nid, event_type_nid, event_state_key_nid, event_id, reference_sha256, auth_event_nids, depth, is_rejected)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
ON CONFLICT DO UPDATE
SET is_rejected = $8 WHERE is_rejected = 0
SET is_rejected = $8 WHERE is_rejected = 1
RETURNING event_nid, state_snapshot_nid;
`