Don't start with any member in autocompl. models

Fix the AutoCompletedMembers filter model to ensure that it doesn't
pick all the items from the corresponding room member model on startup,
wait until the user actually uses the completion feature to fill it.
This commit is contained in:
miruka 2020-08-23 10:54:03 -04:00
parent fc6827807c
commit f68dda9f14
2 changed files with 15 additions and 6 deletions

View File

@ -123,11 +123,17 @@ class FieldStringFilter(ModelFilter):
all lowercase, sensitive otherwise. all lowercase, sensitive otherwise.
""" """
def __init__(self, sync_id: SyncId, fields: Collection[str]) -> None: def __init__(
self.fields: Collection[str] = fields self,
sync_id: SyncId,
fields: Collection[str],
no_filter_accept_all_items: bool = True,
) -> None:
self.fields = fields
self.no_filter_accept_all_items = no_filter_accept_all_items
self._filter: str = "" self._filter: str = ""
self.no_filter_accept_all_items: bool = True
super().__init__(sync_id) super().__init__(sync_id)

View File

@ -125,8 +125,11 @@ class AutoCompletedMembers(FieldStringFilter):
self.room_id = room_id self.room_id = room_id
sync_id = (user_id, room_id, "autocompleted_members") sync_id = (user_id, room_id, "autocompleted_members")
super().__init__(sync_id=sync_id, fields=("display_name", "id")) super().__init__(
self.no_filter_accept_all_items = False sync_id = sync_id,
fields = ("display_name", "id"),
no_filter_accept_all_items = False,
)
def accept_source(self, source: Model) -> bool: def accept_source(self, source: Model) -> bool: