From 9e99edfa420948807d316049c95a1aa418c7ecd0 Mon Sep 17 00:00:00 2001 From: Michael Hollister Date: Fri, 24 May 2024 11:29:25 -0500 Subject: [PATCH] Fixed presence results not returning offline users on initial sync --- changelog.d/17231.bugfix | 1 + synapse/handlers/sync.py | 3 --- tests/module_api/test_api.py | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) create mode 100644 changelog.d/17231.bugfix diff --git a/changelog.d/17231.bugfix b/changelog.d/17231.bugfix new file mode 100644 index 0000000000..322b79dc12 --- /dev/null +++ b/changelog.d/17231.bugfix @@ -0,0 +1 @@ +Fixed presence results not returning offline users on initial sync. Contributed by @Michael-Hollister. \ No newline at end of file diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index ac5bddd52f..56da624895 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -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( diff --git a/tests/module_api/test_api.py b/tests/module_api/test_api.py index 5eb1406a06..1182343ddc 100644 --- a/tests/module_api/test_api.py +++ b/tests/module_api/test_api.py @@ -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)