From 23b05107fb6856f47b53c03ba250172d4d152adb Mon Sep 17 00:00:00 2001 From: Mikunj Date: Wed, 1 Jul 2020 12:27:24 +1000 Subject: [PATCH] Fix closed group infinite request loop --- js/models/conversations.js | 3 ++- ts/receiver/groups.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index c070505e6..ba3c21834 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1861,7 +1861,8 @@ }, sendGroupInfo(recipient) { - if (this.isClosedGroup()) { + // Only send group info if we're a closed group and we haven't left + if (this.isClosedGroup() && !this.get('left')) { const updateParams = { timestamp: Date.now(), groupId: this.id, diff --git a/ts/receiver/groups.ts b/ts/receiver/groups.ts index 96768c057..4b75864d0 100644 --- a/ts/receiver/groups.ts +++ b/ts/receiver/groups.ts @@ -72,11 +72,14 @@ export async function preprocessGroupMessage( return true; } } - if (group.type === GROUP_TYPES.REQUEST_INFO && !newGroup) { - window.libloki.api.debug.logGroupRequestInfo( - `Received GROUP_TYPES.REQUEST_INFO from source: ${source}, primarySource: ${primarySource}, sending back group info.` - ); - conversation.sendGroupInfo(source); + if (group.type === GROUP_TYPES.REQUEST_INFO) { + // We can only send the request info back if we have the information + if (!newGroup) { + window.libloki.api.debug.logGroupRequestInfo( + `Received GROUP_TYPES.REQUEST_INFO from source: ${source}, primarySource: ${primarySource}, sending back group info.` + ); + conversation.sendGroupInfo(source); + } return true; }