Commit 9ca3fd4
authored
fix: register xid record after participant creation, not before (#2540)
createXidRecord was called inside _handleUserIdentification before any
participant row existed. Migration 000015 added a composite FK constraint:
FOREIGN KEY (zid, pid) REFERENCES participants(zid, pid)
With this constraint, inserting an xid record with pid=null (because no
participant exists yet) either fails or leaves the record permanently
unlinked from a participant. When the error propagates through
ensureParticipantOptional's catch block, pid is set to -1 and all
subsequent votes and comments return 500.
Move createXidRecord to after _getOrCreateParticipant in
_ensureParticipantInternal, where both uid and pid are known and the
participant row already exists. This mirrors the correct ordering already
used by _joinWithZidOrSuzinvite.
This is the root cause fix for #2538. A minimal interim fix (try/catch)
was shipped separately in #2539.1 parent 40cccfd commit 9ca3fd4
1 file changed
Lines changed: 25 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
198 | 201 | | |
199 | 202 | | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | 203 | | |
212 | 204 | | |
213 | 205 | | |
| |||
464 | 456 | | |
465 | 457 | | |
466 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
467 | 479 | | |
468 | 480 | | |
469 | 481 | | |
| |||
0 commit comments