From db1a133c25d5006fb20960e8ccb15ac8a4f12673 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 8 Jul 2020 14:47:13 +1000 Subject: [PATCH] drop an expiretimer message with the same timer already on use --- js/background.js | 3 ++- ts/receiver/queuedJob.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/js/background.js b/js/background.js index de60cc502..3bcf3d312 100644 --- a/js/background.js +++ b/js/background.js @@ -631,6 +631,7 @@ 'group' ); const oldMembers = convo.get('members'); + const oldName = convo.getName(); const ev = { groupDetails: { @@ -717,7 +718,7 @@ options, }; - if (!convo.getName() || convo.getName() !== groupName) { + if (oldName !== groupName) { updateObj.name = groupName; } diff --git a/ts/receiver/queuedJob.ts b/ts/receiver/queuedJob.ts index 34493e653..6fc2da5de 100644 --- a/ts/receiver/queuedJob.ts +++ b/ts/receiver/queuedJob.ts @@ -522,6 +522,16 @@ export async function handleMessageJob( handleSessionReset(conversation, message); } else if (message.isExpirationTimerUpdate()) { const { expireTimer } = initialMessage; + const oldValue = conversation.get('expireTimer'); + if (expireTimer === oldValue) { + if (confirm) { + confirm(); + } + window.console.log( + 'Dropping ExpireTimerUpdate message as we already have the same one set.' + ); + return; + } handleExpirationTimerUpdate(conversation, message, source, expireTimer); } else { await handleRegularMessage(