Fix potential exceptions on AllRooms model __init__

Calling super().__init__ may result in source model items being added,
which needs the self.account and self._collapsed attributes to
already exist.
This commit is contained in:
miruka 2020-05-22 16:47:15 -04:00
parent 2ed5798fb7
commit c8f3a4937c

View File

@ -13,13 +13,12 @@ class AllRooms(FieldSubstringFilter):
"""Flat filtered list of all accounts and their rooms."""
def __init__(self, accounts: Model) -> None:
self.accounts = accounts
self._collapsed: Set[str] = set()
super().__init__(sync_id="all_rooms", fields=("display_name",))
self.items_changed_callbacks.append(self.refilter_accounts)
self.accounts = accounts
self._collapsed: Set[str] = set()
def set_account_collapse(self, user_id: str, collapsed: bool) -> None:
"""Set whether the rooms for an account should be filtered out."""