Fixed presence results not returning offline users on initial sync

This commit is contained in:
Michael Hollister 2024-05-24 11:29:25 -05:00
parent 9edb725ebc
commit 9e99edfa42
3 changed files with 2 additions and 4 deletions

1
changelog.d/17231.bugfix Normal file
View file

@ -0,0 +1 @@
Fixed presence results not returning offline users on initial sync. Contributed by @Michael-Hollister.

View file

@ -2281,16 +2281,13 @@ class SyncHandler:
since_token = sync_result_builder.since_token
presence_key = None
include_offline = False
if since_token and not sync_result_builder.full_state:
presence_key = since_token.presence_key
include_offline = True
presence, presence_key = await presence_source.get_new_events(
user=user,
from_key=presence_key,
is_guest=sync_config.is_guest,
include_offline=include_offline,
)
assert presence_key
sync_result_builder.now_token = now_token.copy_and_replace(

View file

@ -916,7 +916,7 @@ def _test_sending_local_online_presence_to_local_user(
presence_updates, sync_token = sync_presence(
test_case, test_case.presence_receiver_id
)
test_case.assertEqual(len(presence_updates), 1)
test_case.assertEqual(len(presence_updates), 2)
presence_update: UserPresenceState = presence_updates[0]
test_case.assertEqual(presence_update.user_id, test_case.presence_sender_id)