complement icon indicating copy to clipboard operation
complement copied to clipboard

Fix flawed membership checks and align membership checking patterns

Open MadLittleMods opened this issue 3 months ago • 0 comments

Spawning from https://github.com/matrix-org/complement/pull/808 per my suggestion on https://github.com/matrix-org/complement/pull/808#discussion_r2445478145,

We have other spots that have flawed membership checks that need to be fixed. For example, when our goal is to wait for the user's membership to be leave, we should keep checking until it is leave. Currently, there are some spots that wait until any membership exists for the user and then asserts leave on that which is flawed because that user may have previous membership events that may be picked up first instead of waiting for the leave.

This PR fixes those flawed checks and aligns our membership checks so we don't cargo cult this bad pattern elsewhere.

  • Generalize our client.SyncXXX helpers to use syncMembershipIn utility
    • More robust
    • Standardize extra checks on event (previously, only available with client.SyncJoinedTo)
  • Introduce client.SyncBannedFrom so we can differentiate ban/leave

Dev notes

  • https://github.com/matrix-org/complement/pull/272
  • https://github.com/matrix-org/complement/pull/511

Pull Request Checklist

Signed-off-by: Eric Eastwood [email protected]

MadLittleMods avatar Oct 27 '25 20:10 MadLittleMods