From 835d7bfb9ddfd7a777659af5c2071cbb7134b7ae Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 19 Sep 2019 17:16:57 +0100 Subject: [PATCH 1/6] Fix origin migrator for SSO logins For some reason this was trying to close the same window twice when the app was reloaded after an SSO login. Possibly also a problem on electron < 6 - presumably a race condition. --- electron_app/src/originMigrator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/electron_app/src/originMigrator.js b/electron_app/src/originMigrator.js index 58bb0feb..bc6acfab 100644 --- a/electron_app/src/originMigrator.js +++ b/electron_app/src/originMigrator.js @@ -33,7 +33,7 @@ async function migrateFromOldOrigin() { webgl: false, }, }); - ipcMain.on('origin_migration_complete', (e, success, sentSummary, storedSummary) => { + ipcMain.once('origin_migration_complete', (e, success, sentSummary, storedSummary) => { if (success) { console.log("Origin migration completed successfully!"); } else { @@ -44,7 +44,7 @@ async function migrateFromOldOrigin() { migrateWindow.close(); resolve(); }); - ipcMain.on('origin_migration_nodata', (e) => { + ipcMain.once('origin_migration_nodata', (e) => { console.log("No session to migrate from old origin"); migrateWindow.close(); resolve(); From 6464bfe850c83a2c402434bfe411011fafa6806f Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 19 Sep 2019 17:41:08 +0100 Subject: [PATCH 2/6] Remove the other listener when one fires --- electron_app/src/originMigrator.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/electron_app/src/originMigrator.js b/electron_app/src/originMigrator.js index bc6acfab..0344ede7 100644 --- a/electron_app/src/originMigrator.js +++ b/electron_app/src/originMigrator.js @@ -33,7 +33,11 @@ async function migrateFromOldOrigin() { webgl: false, }, }); - ipcMain.once('origin_migration_complete', (e, success, sentSummary, storedSummary) => { + const onOriginMigrationComplete = (e, success, sentSummary, storedSummary) => { + // we use once but we'll only get once of these events, + // so remove the listener for the other one + ipcMain.removeListener('origin_migration_nodata', onOriginMigrationNoData); + if (success) { console.log("Origin migration completed successfully!"); } else { @@ -43,12 +47,18 @@ async function migrateFromOldOrigin() { console.error("Data stored", storedSummary); migrateWindow.close(); resolve(); - }); - ipcMain.once('origin_migration_nodata', (e) => { + }; + const onOriginMigrationNoData = (e, success, sentSummary, storedSummary) => { + ipcMain.removeListener('origin_migration_complete', onOriginMigrationComplete); + console.log("No session to migrate from old origin"); migrateWindow.close(); resolve(); - }); + }; + + ipcMain.once('origin_migration_complete', onOriginMigrationComplete); + ipcMain.once('origin_migration_nodata', onOriginMigrationNoData); + // Normalise the path because in the distribution, __dirname will be inside the // electron asar. const sourcePagePath = path.normalize(__dirname + '/../../origin_migrator/source.html'); From 42b756952ef40c330f80d81cde955c507e5d4023 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 19 Sep 2019 17:42:43 +0100 Subject: [PATCH 3/6] Typo Co-Authored-By: J. Ryan Stinnett --- electron_app/src/originMigrator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron_app/src/originMigrator.js b/electron_app/src/originMigrator.js index 0344ede7..90a33de1 100644 --- a/electron_app/src/originMigrator.js +++ b/electron_app/src/originMigrator.js @@ -34,7 +34,7 @@ async function migrateFromOldOrigin() { }, }); const onOriginMigrationComplete = (e, success, sentSummary, storedSummary) => { - // we use once but we'll only get once of these events, + // we use once but we'll only get one of these events, // so remove the listener for the other one ipcMain.removeListener('origin_migration_nodata', onOriginMigrationNoData); From 5feb4f9c890cdc77ff3f5ea6d604d193dc588280 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Thu, 19 Sep 2019 17:50:59 +0100 Subject: [PATCH 4/6] v1.3.6 --- electron_app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron_app/package.json b/electron_app/package.json index b9017c12..e1e7b773 100644 --- a/electron_app/package.json +++ b/electron_app/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "src/electron-main.js", - "version": "1.3.5", + "version": "1.3.6", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "dependencies": { From 6998aa94fddba210530bd4018c8e23d651392d68 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Thu, 19 Sep 2019 17:51:56 +0100 Subject: [PATCH 5/6] Prepare changelog for v1.3.6 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7415ca7..177b1106 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +Changes in [1.3.6](https://github.com/vector-im/riot-web/releases/tag/v1.3.6) (2019-09-19) +========================================================================================== +[Full Changelog](https://github.com/vector-im/riot-web/compare/v1.3.5...v1.3.6) + + * Fix origin migrator for SSO logins + [\#10920](https://github.com/vector-im/riot-web/pull/10920) + Changes in [1.3.5](https://github.com/vector-im/riot-web/releases/tag/v1.3.5) (2019-09-16) ========================================================================================== [Full Changelog](https://github.com/vector-im/riot-web/compare/v1.3.5-rc.3...v1.3.5) From ab3f1f829ad3fa70c3a16d38d391f1be8b36357c Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Thu, 19 Sep 2019 17:51:56 +0100 Subject: [PATCH 6/6] v1.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7551ee24..a716c98d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "riot-web", "productName": "Riot", "main": "electron_app/src/electron-main.js", - "version": "1.3.5", + "version": "1.3.6", "description": "A feature-rich client for Matrix.org", "author": "New Vector Ltd.", "repository": {