summary refs log tree commit diff
path: root/synapse/handlers/room_member.py
diff options
context:
space:
mode:
authorDirk Klimpel <5740567+dklimpel@users.noreply.github.com>2022-08-30 11:58:38 +0200
committerGitHub <noreply@github.com>2022-08-30 09:58:38 +0000
commit682dfcfc0db05d9c99b7615d950997535df4d533 (patch)
treef89c16787f214105d36a7030dd97e4b865fd898c /synapse/handlers/room_member.py
parentOptimize how we calculate `likely_domains` during backfill (#13575) (diff)
downloadsynapse-682dfcfc0db05d9c99b7615d950997535df4d533.tar.xz
Fix that user cannot `/forget` rooms after the last member has left (#13546)
Diffstat (limited to 'synapse/handlers/room_member.py')
-rw-r--r--synapse/handlers/room_member.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index 709682622f..e726997d83 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -1925,8 +1925,11 @@ class RoomMemberMasterHandler(RoomMemberHandler):
         ]:
             raise SynapseError(400, "User %s in room %s" % (user_id, room_id))
 
-        if membership:
-            await self.store.forget(user_id, room_id)
+        # In normal case this call is only required if `membership` is not `None`.
+        # But: After the last member had left the room, the background update
+        # `_background_remove_left_rooms` is deleting rows related to this room from
+        # the table `current_state_events` and `get_current_state_events` is `None`.
+        await self.store.forget(user_id, room_id)
 
 
 def get_users_which_can_issue_invite(auth_events: StateMap[EventBase]) -> List[str]: