MSC4140: handle 409 on delayed event management in the MatrixRTC MembershipManager (#5553)
* MSC4140: handle 409 on delayed event management in the MembershipManager
A homeserver that keeps finalised delayed events answers a management
action that conflicts with the event's outcome with HTTP 409 (MSC4140,
"Managing scheduled delayed events"). The MembershipManager only knew
about the 404 that servers answer today once the row is deleted, and
treated a 409 on restart or cancel as an unrecoverable error.
Treat a 409 like a 404: the delayed event is finalised and will not do
what we asked, so drop the delay id and schedule the follow-up action.
No errcode is mandated for this case, so match on the HTTP status.
* Use toBeUndefined() in the new 409 tests
Addresses the SonarCloud code smell on the PR.
* Update src/matrixrtc/MembershipManager.ts
Co-authored-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Keep the 404/409 conditions on the predicate only
Call sites and doc comments describe what a gone delayed event means for
them instead of repeating which responses count as gone.
* Adapt to changes on develop
---------
Co-authored-by: Johannes Marbach <n0-0ne+github@mailbox.org>