mirror of
https://github.com/zulip/zulip.git
synced 2025-11-20 22:48:16 +00:00
zerver/models.py: Fix string annotations in UserPresence.
This commit is contained in:
committed by
Tim Abbott
parent
e11bec28c2
commit
81759d56be
@@ -2,6 +2,7 @@ from __future__ import absolute_import
|
|||||||
from typing import Any, List, Set, Tuple, TypeVar, \
|
from typing import Any, List, Set, Tuple, TypeVar, \
|
||||||
Union, Optional, Sequence, AbstractSet
|
Union, Optional, Sequence, AbstractSet
|
||||||
from typing.re import Match
|
from typing.re import Match
|
||||||
|
from zerver.lib.str_utils import NonBinaryStr
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet
|
||||||
@@ -1443,7 +1444,7 @@ class UserPresence(models.Model):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def to_presence_dict(client_name=None, status=None, dt=None, push_enabled=None,
|
def to_presence_dict(client_name=None, status=None, dt=None, push_enabled=None,
|
||||||
has_push_devices=None, is_mirror_dummy=None):
|
has_push_devices=None, is_mirror_dummy=None):
|
||||||
# type: (Optional[str], Optional[int], Optional[datetime.datetime], Optional[bool], Optional[bool], Optional[bool]) -> Dict[str, Any]
|
# type: (Optional[text_type], Optional[int], Optional[datetime.datetime], Optional[bool], Optional[bool], Optional[bool]) -> Dict[str, Any]
|
||||||
presence_val = UserPresence.status_to_string(status)
|
presence_val = UserPresence.status_to_string(status)
|
||||||
|
|
||||||
timestamp = datetime_to_timestamp(dt)
|
timestamp = datetime_to_timestamp(dt)
|
||||||
@@ -1464,7 +1465,7 @@ class UserPresence(models.Model):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def status_from_string(status):
|
def status_from_string(status):
|
||||||
# type: (str) -> Optional[int]
|
# type: (NonBinaryStr) -> Optional[int]
|
||||||
if status == 'active':
|
if status == 'active':
|
||||||
status_val = UserPresence.ACTIVE
|
status_val = UserPresence.ACTIVE
|
||||||
elif status == 'idle':
|
elif status == 'idle':
|
||||||
|
|||||||
Reference in New Issue
Block a user