From 528d15bf2d5677c3764e0c7613267d7b730f4777 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 18 Jan 2024 11:31:27 +1100 Subject: [PATCH] fix: fix convo volatile updates for 03-groups --- ts/receiver/configMessage.ts | 22 ++++++++++++++++++- .../libsession_utils_convo_info_volatile.ts | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ts/receiver/configMessage.ts b/ts/receiver/configMessage.ts index 7218bba57..7e8e1bbe7 100644 --- a/ts/receiver/configMessage.ts +++ b/ts/receiver/configMessage.ts @@ -919,7 +919,27 @@ async function handleConvoInfoVolatileUpdate() { break; case 'Group': - // debugger; // we need to update the current read messages of that group 03 with what we have in the wrapper // debugger + try { + const groupsV2 = await ConvoInfoVolatileWrapperActions.getAllGroups(); + for (let index = 0; index < groupsV2.length; index++) { + const fromWrapper = groupsV2[index]; + + try { + await applyConvoVolatileUpdateFromWrapper( + fromWrapper.pubkeyHex, + fromWrapper.unread, + fromWrapper.lastRead + ); + } catch (e) { + window.log.warn( + 'handleConvoInfoVolatileUpdate of "Group" failed with error: ', + e.message + ); + } + } + } catch (e) { + window.log.warn('getAllGroups of "Group" failed with error: ', e.message); + } break; default: diff --git a/ts/session/utils/libsession/libsession_utils_convo_info_volatile.ts b/ts/session/utils/libsession/libsession_utils_convo_info_volatile.ts index 44c55c045..aa96e4e87 100644 --- a/ts/session/utils/libsession/libsession_utils_convo_info_volatile.ts +++ b/ts/session/utils/libsession/libsession_utils_convo_info_volatile.ts @@ -309,7 +309,7 @@ async function removeContactFromWrapper(convoId: string) { * whole other bunch of issues because it is a native node module. */ function getConvoInfoVolatileTypes(): Array { - return ['1o1', 'LegacyGroup', 'Community']; + return ['1o1', 'LegacyGroup', 'Group', 'Community']; } export const SessionUtilConvoInfoVolatile = {