Fix filtered_members models updates
This commit is contained in:
parent
055b68126a
commit
b38fbc6d9b
|
@ -1,6 +1,7 @@
|
||||||
# Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
# Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
||||||
# SPDX-License-Identifier: LGPL-3.0-or-later
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
|
from copy import copy
|
||||||
from typing import TYPE_CHECKING, Any, Dict, Optional
|
from typing import TYPE_CHECKING, Any, Dict, Optional
|
||||||
|
|
||||||
from . import SyncId
|
from . import SyncId
|
||||||
|
@ -40,7 +41,7 @@ class ModelProxy(Model):
|
||||||
they should be converted to a same `ModelItem`
|
they should be converted to a same `ModelItem`
|
||||||
subclass by overriding this function.
|
subclass by overriding this function.
|
||||||
"""
|
"""
|
||||||
return item
|
return copy(item)
|
||||||
|
|
||||||
|
|
||||||
def source_item_set(
|
def source_item_set(
|
||||||
|
|
|
@ -12,8 +12,12 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
ORDER: Dict[str, int] = {
|
ORDER: Dict[str, int] = {
|
||||||
"online": 0,
|
"online": 0,
|
||||||
"unavailable": 1,
|
"echo_online": 1,
|
||||||
"offline": 2,
|
"unavailable": 2,
|
||||||
|
"echo_unavailable": 3,
|
||||||
|
"invisible": 4,
|
||||||
|
"echo_invisible": 5,
|
||||||
|
"offline": 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +54,6 @@ class Presence:
|
||||||
cleared when client stops (`MatrixClient._start()`).
|
cleared when client stops (`MatrixClient._start()`).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class State(AutoStrEnum):
|
class State(AutoStrEnum):
|
||||||
offline = auto() # can mean offline, invisible or unknwon
|
offline = auto() # can mean offline, invisible or unknwon
|
||||||
unavailable = auto()
|
unavailable = auto()
|
||||||
|
@ -64,7 +67,6 @@ class Presence:
|
||||||
def __lt__(self, other: "Presence.State") -> bool:
|
def __lt__(self, other: "Presence.State") -> bool:
|
||||||
return ORDER[self.value] < ORDER[other.value]
|
return ORDER[self.value] < ORDER[other.value]
|
||||||
|
|
||||||
|
|
||||||
presence: State = State.offline
|
presence: State = State.offline
|
||||||
currently_active: bool = False
|
currently_active: bool = False
|
||||||
last_active_at: datetime = datetime.fromtimestamp(0)
|
last_active_at: datetime = datetime.fromtimestamp(0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user