From f68dda9f14a14c8faf97fa672ed9c21392c69b6d Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 23 Aug 2020 10:54:03 -0400 Subject: [PATCH] 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. --- src/backend/models/filters.py | 14 ++++++++++---- src/backend/models/special_models.py | 7 +++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/backend/models/filters.py b/src/backend/models/filters.py index acb00798..16bb312e 100644 --- a/src/backend/models/filters.py +++ b/src/backend/models/filters.py @@ -123,11 +123,17 @@ class FieldStringFilter(ModelFilter): all lowercase, sensitive otherwise. """ - def __init__(self, sync_id: SyncId, fields: Collection[str]) -> None: - self.fields: Collection[str] = fields - self._filter: str = "" + def __init__( + 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.no_filter_accept_all_items: bool = True super().__init__(sync_id) diff --git a/src/backend/models/special_models.py b/src/backend/models/special_models.py index 6b44916b..072ce18e 100644 --- a/src/backend/models/special_models.py +++ b/src/backend/models/special_models.py @@ -125,8 +125,11 @@ class AutoCompletedMembers(FieldStringFilter): self.room_id = room_id sync_id = (user_id, room_id, "autocompleted_members") - super().__init__(sync_id=sync_id, fields=("display_name", "id")) - self.no_filter_accept_all_items = False + super().__init__( + sync_id = sync_id, + fields = ("display_name", "id"), + no_filter_accept_all_items = False, + ) def accept_source(self, source: Model) -> bool: