Group together the now_false cases
Justification: - the only way to hit the final else branch is if `change is MatchChange.now_false` - if `not is_in_room`, then the `state_key` will be one of the `user_id in user_ids` and so we'll call `self._handle_remove_user` with the `state_key` and return early - therefore the call to `_handle_remove_user` in the final else branch was only hit if `is_in_room`, and so it can be moved to first `else` branch. Having made this change we now have three mutually exclusive cases (now_false, now_true, no_change). Therefore I can change if->elif for the no_change branch.
This commit is contained in:
@@ -321,8 +321,8 @@ class UserDirectoryHandler(StateDeltasHandler):
|
||||
return
|
||||
else:
|
||||
logger.debug("Server is still in room: %r", room_id)
|
||||
|
||||
if change is MatchChange.no_change:
|
||||
await self._handle_remove_user(room_id, state_key)
|
||||
elif change is MatchChange.no_change:
|
||||
# Handle any profile changes for remote users.
|
||||
# (For local users we are not forced to scan membership
|
||||
# events; instead the rest of the application calls
|
||||
@@ -342,8 +342,6 @@ class UserDirectoryHandler(StateDeltasHandler):
|
||||
state_key, event_id
|
||||
)
|
||||
await self._track_user_joined_room(room_id, state_key)
|
||||
else: # The user left
|
||||
await self._handle_remove_user(room_id, state_key)
|
||||
|
||||
async def _upsert_directory_entry_for_remote_user(
|
||||
self, user_id: str, event_id: str
|
||||
|
||||
Reference in New Issue
Block a user