Stop get_joined_users corruption from custom statuses (#7376)

Fix a bug where the `get_joined_users` cache could be corrupted by custom
status events (or other state events with a state_key matching the user ID).

The bug was introduced by #2229, but has largely gone unnoticed since then.

Fixes #7099, #7373.
This commit is contained in:
Richard van der Hoff 2020-05-14 10:07:54 +01:00 committed by GitHub
parent 5d64fefd6c
commit a0e063387d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 52 additions and 2 deletions

View file

@ -576,7 +576,8 @@ class RoomMemberWorkerStore(EventsWorkerStore):
if key[0] == EventTypes.Member
]
for etype, state_key in context.delta_ids:
users_in_room.pop(state_key, None)
if etype == EventTypes.Member:
users_in_room.pop(state_key, None)
# We check if we have any of the member event ids in the event cache
# before we ask the DB