mirror of https://github.com/zulip/zulip.git
presence: Return last_update_id=-1 on zephyr mirror realm.
This was a bug, where in the realm.presence_disabled (synonymous to being a zephyr mirror realm) case we would return None. We have decided on the convention of using only integers here, and -1 representing lack of data.
This commit is contained in:
parent
45118180bb
commit
f0ec4f5732
|
@ -213,10 +213,10 @@ def get_presences_for_realm(
|
|||
slim_presence: bool,
|
||||
last_update_id_fetched_by_client: Optional[int],
|
||||
requesting_user_profile: UserProfile,
|
||||
) -> Tuple[Dict[str, Dict[str, Dict[str, Any]]], Optional[int]]:
|
||||
) -> Tuple[Dict[str, Dict[str, Dict[str, Any]]], int]:
|
||||
if realm.presence_disabled:
|
||||
# Return an empty dict if presence is disabled in this realm
|
||||
return defaultdict(dict), None
|
||||
return defaultdict(dict), -1
|
||||
|
||||
return get_presence_dict_by_realm(
|
||||
realm,
|
||||
|
|
|
@ -490,6 +490,7 @@ class UserPresenceTests(ZulipTestCase):
|
|||
result = self.client_post("/json/users/me/presence", {"status": "idle"}, subdomain="zephyr")
|
||||
response_dict = self.assert_json_success(result)
|
||||
self.assertEqual(response_dict["presences"], {})
|
||||
self.assertEqual(response_dict["presence_last_update_id"], -1)
|
||||
|
||||
def test_mirror_presence(self) -> None:
|
||||
"""Zephyr mirror realms find out the status of their mirror bot"""
|
||||
|
|
Loading…
Reference in New Issue