From 1a9206fdbe9620e941310e1311bd625d25866e3d Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Wed, 4 Mar 2020 16:31:10 +0100 Subject: [PATCH 1/4] Move cleanupOrphanedAttachments before restart --- js/background.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/js/background.js b/js/background.js index 7761fbe94..1cda5ea4d 100644 --- a/js/background.js +++ b/js/background.js @@ -398,6 +398,13 @@ await storage.put('version', currentVersion); if (newVersion) { + + await window.Signal.Data.cleanupOrphanedAttachments(); + + window.log.info( + `New version detected: ${currentVersion}; previous: ${lastVersion}` + ); + if ( lastVersion && window.isBeforeVersion(lastVersion, 'v1.15.0-beta.5') @@ -405,10 +412,6 @@ await window.Signal.Logs.deleteAll(); window.restart(); } - - window.log.info( - `New version detected: ${currentVersion}; previous: ${lastVersion}` - ); } if (isIndexedDBPresent) { @@ -431,10 +434,6 @@ Views.Initialization.setMessage(window.i18n('optimizingApplication')); - if (newVersion) { - await window.Signal.Data.cleanupOrphanedAttachments(); - } - Views.Initialization.setMessage(window.i18n('loading')); idleDetector = new IdleDetector(); From f7d562eafef91dec0b3f9b4609d9fc4aa09f8cf0 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Wed, 4 Mar 2020 17:00:38 +0100 Subject: [PATCH 2/4] lint remove empty line after newVersion if --- js/background.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/background.js b/js/background.js index 1cda5ea4d..3ff691d57 100644 --- a/js/background.js +++ b/js/background.js @@ -398,7 +398,6 @@ await storage.put('version', currentVersion); if (newVersion) { - await window.Signal.Data.cleanupOrphanedAttachments(); window.log.info( From 1ea0edafa9c03c2b32bfc8fd1c1a0e4fdb0d8f50 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Wed, 4 Mar 2020 23:15:25 +0100 Subject: [PATCH 3/4] Remove redundant if statement to avoid future bugs --- js/background.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/js/background.js b/js/background.js index 3ff691d57..c9cb76bc9 100644 --- a/js/background.js +++ b/js/background.js @@ -398,19 +398,15 @@ await storage.put('version', currentVersion); if (newVersion) { - await window.Signal.Data.cleanupOrphanedAttachments(); - window.log.info( `New version detected: ${currentVersion}; previous: ${lastVersion}` ); - if ( - lastVersion && - window.isBeforeVersion(lastVersion, 'v1.15.0-beta.5') - ) { - await window.Signal.Logs.deleteAll(); - window.restart(); - } + await window.Signal.Data.cleanupOrphanedAttachments(); + + await window.Signal.Logs.deleteAll(); + + window.restart(); } if (isIndexedDBPresent) { From 9cc9d61fcd8b95ae0bf7c81afc88510d8237deb5 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Wed, 4 Mar 2020 23:29:24 +0100 Subject: [PATCH 4/4] Remove a redundant restart call --- js/background.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/js/background.js b/js/background.js index c9cb76bc9..62c505222 100644 --- a/js/background.js +++ b/js/background.js @@ -405,8 +405,6 @@ await window.Signal.Data.cleanupOrphanedAttachments(); await window.Signal.Logs.deleteAll(); - - window.restart(); } if (isIndexedDBPresent) {