UserPresence: Cleanup confusing to_presence_dict arguments.

This commit is contained in:
Tim Abbott 2017-02-10 19:13:33 -08:00
parent 1c0f65cbec
commit 2140d2963d
1 changed files with 8 additions and 8 deletions

View File

@ -1359,9 +1359,9 @@ class UserPresence(models.Model):
for row in query: for row in query:
info = UserPresence.to_presence_dict( info = UserPresence.to_presence_dict(
client_name=row['client__name'], row['client__name'],
status=row['status'], row['status'],
dt=row['timestamp'], row['timestamp'],
push_enabled=row['user_profile__enable_offline_push_notifications'], push_enabled=row['user_profile__enable_offline_push_notifications'],
has_push_devices=row['user_profile__id'] in mobile_user_ids, has_push_devices=row['user_profile__id'] in mobile_user_ids,
is_mirror_dummy=row['user_profile__is_mirror_dummy'], is_mirror_dummy=row['user_profile__is_mirror_dummy'],
@ -1371,9 +1371,9 @@ class UserPresence(models.Model):
return user_statuses return user_statuses
@staticmethod @staticmethod
def to_presence_dict(client_name=None, status=None, dt=None, push_enabled=None, def to_presence_dict(client_name, status, dt, push_enabled=None,
has_push_devices=None, is_mirror_dummy=None): has_push_devices=None, is_mirror_dummy=None):
# type: (Optional[Text], Optional[int], Optional[datetime.datetime], Optional[bool], Optional[bool], Optional[bool]) -> Dict[str, Any] # type: (Text, int, 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)
@ -1387,9 +1387,9 @@ class UserPresence(models.Model):
def to_dict(self): def to_dict(self):
# type: () -> Dict[str, Any] # type: () -> Dict[str, Any]
return UserPresence.to_presence_dict( return UserPresence.to_presence_dict(
client_name=self.client.name, self.client.name,
status=self.status, self.status,
dt=self.timestamp self.timestamp
) )
@staticmethod @staticmethod