-
-
Notifications
You must be signed in to change notification settings - Fork 132
Description
Link to problem area:
https://spec.matrix.org/v1.17/client-server-api/#get_matrixclientv3roomsroomidmembers
Issue
Server behavior when both membership and not_membership are present is currently specced as:
When specified alongside
not_membership, the two parameters create an ‘or’ condition: either the membership is the same asmembershipor is not the same asnot_membership.
No existing server implementations do this - Synapse, Dendrite and Conduwuits read this with an 'and' in place of 'or'.
For example if membership=join and not_membership=join is specified, all implementations return nothing, while if the code was following what the spec says it should return all member events ( x == join OR x != join is always true ).
Support for membership and not_membership parameters across implementations:
- Synapse (introduced in matrix-org/synapse@2f78f43): code
- Dendrite (introduced in element-hq/dendrite@313cb3f): code
- Conduwuit (introduced in x86pup/conduwuit@0877f29): code
All three are broken in the same way, if both filters are present the results of comparisons are combined with an 'and' instead of an 'or'. Conduit ignores the membership and not_membership query parameters.
Neither Complement nor Sytest has tests with both membership and not_membership set. Complement has a test for the two parameters individually, but not combined.
The parameters were introduced in MSC1227, which doesn't specify the behavior when both are present:
We extend the /members API to let the user query which members are present in a given room (for populating MemberList), filtered based on membership state and as of a given sync token.
The parameters were added to the spec in matrix-org/matrix-spec-proposals#2035, which post-dates the Synapse implementation. It looks like this was done incorrectly.
Expected behaviour
The spec should be changed to match all current implementations.
Current:
membership:
When specified alongsidenot_membership, the two parameters create an ‘or’ condition: either the membership is the same asmembershipor is not the same asnot_membership.
Proposed:
membership:
When specified alongsidenot_membership, the two parameters create an ‘and’ condition: the membership is the same asmembershipand is not the same asnot_membership.