diff options
author | Andrew Morgan <andrew@amorgan.xyz> | 2021-12-08 18:36:08 +0000 |
---|---|---|
committer | Andrew Morgan <andrew@amorgan.xyz> | 2021-12-08 18:36:17 +0000 |
commit | f1f88172d8762d24be1b2e4c4139eff800d44adc (patch) | |
tree | cd38de12cbe878628c76cf6b4168f0de7e42e11e | |
parent | Fix up database method to grab device list changes - bit dirty (diff) | |
download | synapse-f1f88172d8762d24be1b2e4c4139eff800d44adc.tar.xz |
Move DeviceLists type to synapse.types
Such that we can use it elsewhere.
-rw-r--r-- | synapse/handlers/sync.py | 28 | ||||
-rw-r--r-- | synapse/types.py | 16 |
2 files changed, 18 insertions, 26 deletions
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 53d4627147..025eb82434 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -13,17 +13,7 @@ # limitations under the License. import itertools import logging -from typing import ( - TYPE_CHECKING, - Any, - Collection, - Dict, - FrozenSet, - List, - Optional, - Set, - Tuple, -) +from typing import TYPE_CHECKING, Any, Dict, FrozenSet, List, Optional, Set, Tuple import attr from prometheus_client import Counter @@ -39,6 +29,7 @@ from synapse.push.clientformat import format_push_rules_for_user from synapse.storage.roommember import MemberSummary from synapse.storage.state import StateFilter from synapse.types import ( + DeviceLists, JsonDict, MutableStateMap, Requester, @@ -183,21 +174,6 @@ class GroupsSyncResult: return bool(self.join or self.invite or self.leave) -@attr.s(slots=True, frozen=True, auto_attribs=True) -class DeviceLists: - """ - Attributes: - changed: List of user_ids whose devices may have changed - left: List of user_ids whose devices we no longer track - """ - - changed: Collection[str] - left: Collection[str] - - def __bool__(self) -> bool: - return bool(self.changed or self.left) - - @attr.s(slots=True, auto_attribs=True) class _RoomChanges: """The set of room entries to include in the sync, plus the set of joined diff --git a/synapse/types.py b/synapse/types.py index fb72f19343..7346498f61 100644 --- a/synapse/types.py +++ b/synapse/types.py @@ -20,6 +20,7 @@ from typing import ( TYPE_CHECKING, Any, ClassVar, + Collection, Dict, Mapping, MutableMapping, @@ -751,6 +752,21 @@ class ReadReceipt: data = attr.ib() +@attr.s(slots=True, frozen=True, auto_attribs=True) +class DeviceLists: + """ + Attributes: + changed: List of user_ids whose devices may have changed + left: List of user_ids whose devices we no longer track + """ + + changed: Collection[str] + left: Collection[str] + + def __bool__(self) -> bool: + return bool(self.changed or self.left) + + def get_verify_key_from_cross_signing_key(key_info): """Get the key ID and signedjson verify key from a cross-signing key dict |