From 44fc0fc2dddf358456212290b99e2e9c5c3e999a Mon Sep 17 00:00:00 2001 From: jubb Date: Thu, 11 Aug 2022 09:50:10 +1000 Subject: [PATCH] fix: only fetch latest messages on first join --- .../session/libsession/messaging/open_groups/OpenGroupApi.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/open_groups/OpenGroupApi.kt b/libsession/src/main/java/org/session/libsession/messaging/open_groups/OpenGroupApi.kt index fb4b6a7b90..87da109836 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/open_groups/OpenGroupApi.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/open_groups/OpenGroupApi.kt @@ -576,6 +576,7 @@ object OpenGroupApi { ) rooms.forEach { room -> val infoUpdates = storage.getOpenGroup(room, server)?.infoUpdates ?: 0 + val lastMessageServerId = storage.getLastMessageServerID(room, server) ?: 0L requests.add( BatchRequestInfo( request = BatchRequest( @@ -587,7 +588,7 @@ object OpenGroupApi { ) ) requests.add( - if (shouldRetrieveRecentMessages) { + if (shouldRetrieveRecentMessages || lastMessageServerId == 0L) { BatchRequestInfo( request = BatchRequest( method = GET, @@ -597,7 +598,6 @@ object OpenGroupApi { responseType = object : TypeReference>(){} ) } else { - val lastMessageServerId = storage.getLastMessageServerID(room, server) ?: 0L BatchRequestInfo( request = BatchRequest( method = GET,