From 78068bfaa0e17ead04d75a4fcf4f179333ba1bd4 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 19 Jun 2017 11:58:44 +0100 Subject: [PATCH 01/13] explicit convert to nativeImage to stabilise on Windows Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- electron_app/src/tray.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/electron_app/src/tray.js b/electron_app/src/tray.js index 039e7133f..c2fa50c96 100644 --- a/electron_app/src/tray.js +++ b/electron_app/src/tray.js @@ -54,33 +54,38 @@ exports.create = function(win, config) { }, ]); - trayIcon = new Tray(config.icon_path); + const defaultIcon = nativeImage.createFromPath(config.icon_path); + + trayIcon = new Tray(defaultIcon); trayIcon.setToolTip(config.brand); trayIcon.setContextMenu(contextMenu); trayIcon.on('click', toggleWin); let lastFavicon = null; win.webContents.on('page-favicon-updated', async function(ev, favicons) { - let newFavicon = config.icon_path; - if (favicons && favicons.length > 0 && favicons[0].startsWith('data:')) { - newFavicon = favicons[0]; + if (!favicons || favicons.length <= 0 || !favicons[0].startsWith('data:')) { + if (lastFavicon !== null) { + win.setIcon(defaultIcon); + trayIcon.setImage(defaultIcon); + lastFavicon = null; + } + return; } // No need to change, shortcut - if (newFavicon === lastFavicon) return; - lastFavicon = newFavicon; + if (favicons[0] === lastFavicon) return; + lastFavicon = favicons[0]; - // if its not default we have to construct into nativeImage - if (newFavicon !== config.icon_path) { - newFavicon = nativeImage.createFromDataURL(favicons[0]); + let newFavicon = nativeImage.createFromDataURL(favicons[0]); - if (process.platform === 'win32') { - try { - const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico') - const icoBuf = await pngToIco(newFavicon.toPNG()); - fs.writeFileSync(icoPath, icoBuf); - newFavicon = icoPath; - } catch (e) {console.error(e);} + // Windows likes ico's too much. + if (process.platform === 'win32') { + try { + const icoPath = path.join(app.getPath('temp'), 'win32_riot_icon.ico'); + fs.writeFileSync(icoPath, await pngToIco(newFavicon.toPNG())); + newFavicon = nativeImage.createFromPath(icoPath); + } catch (e) { + console.error("Failed to make win32 ico", e); } } From b9fc46fa412ccaa9ec49a396691fb1cdb1f286e8 Mon Sep 17 00:00:00 2001 From: turt2live Date: Mon, 19 Jun 2017 16:24:03 -0600 Subject: [PATCH 02/13] Change missed 'Redact' to 'Remove' in ImageView. Signed-off-by: Travis Ralston --- src/components/views/elements/ImageView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/elements/ImageView.js b/src/components/views/elements/ImageView.js index dd0490ac0..f9404eacd 100644 --- a/src/components/views/elements/ImageView.js +++ b/src/components/views/elements/ImageView.js @@ -158,7 +158,7 @@ module.exports = React.createClass({ var eventRedact; if(showEventMeta) { eventRedact = (
- { _t('Redact') } + { _t('Remove') }
); } From 4ae6e9fdfdba8dd014e0559753ea47919583155a Mon Sep 17 00:00:00 2001 From: turt2live Date: Mon, 19 Jun 2017 16:31:59 -0600 Subject: [PATCH 03/13] Remove 'Redact' from en_US and en_EN as it is no longer needed Signed-off-by: Travis Ralston --- src/i18n/strings/en_EN.json | 1 - src/i18n/strings/en_US.json | 1 - 2 files changed, 2 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4717e267e..cc68228fe 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -98,7 +98,6 @@ "Please Register": "Please Register", "powered by Matrix": "powered by Matrix", "Quote": "Quote", - "Redact": "Redact", "Reject": "Reject", "Remove %(name)s from the directory?": "Remove %(name)s from the directory?", "Remove": "Remove", diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index 2d7a5fa14..29e089ef6 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -96,7 +96,6 @@ "Please Register": "Please Register", "powered by Matrix": "powered by Matrix", "Quote": "Quote", - "Redact": "Redact", "Reject": "Reject", "Remove %(name)s from the directory?": "Remove %(name)s from the directory?", "Remove": "Remove", From bbbb82351fe39816f77c620a5107354002740f81 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 20 Jun 2017 14:33:34 +0100 Subject: [PATCH 04/13] CSS for redeisng of password warning Now looks like red text --- .../css/matrix-react-sdk/structures/_UserSettings.scss | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/skins/vector/css/matrix-react-sdk/structures/_UserSettings.scss b/src/skins/vector/css/matrix-react-sdk/structures/_UserSettings.scss index 9809a81ab..31686a7c4 100644 --- a/src/skins/vector/css/matrix-react-sdk/structures/_UserSettings.scss +++ b/src/skins/vector/css/matrix-react-sdk/structures/_UserSettings.scss @@ -102,6 +102,13 @@ limitations under the License. padding-right: 1em; } +.mx_UserSettings_passwordWarning { + /* To move the "Sign out" button out of the way */ + clear: both; + color: $warning-color; + margin-bottom: 5px; +} + .mx_UserSettings_importExportButtons { padding-top: 10px; padding-left: 40px; From 8f8b28425dc90aaa802458e65543d53a93cc87fe Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 20 Jun 2017 15:55:04 +0100 Subject: [PATCH 05/13] Fix json fail --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 99b961a07..d6b05cbde 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -200,5 +200,5 @@ "You have successfully set a password and an email address!": "You have successfully set a password and an email address!", "Remember, you can always set an email address in user settings if you change your mind.": "Remember, you can always set an email address in user settings if you change your mind.", "To return to your account in future you need to set a password": "To return to your account in future you need to set a password", - "Set Password" + "Set Password": "Set Password" } From abf21675d50bf879cb6dd1b15e417e73ae7aeb56 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 20 Jun 2017 15:35:01 +0100 Subject: [PATCH 06/13] Add some more logging to the tests ... to help diagnose when they fail --- test/app-tests/loading.js | 3 ++- test/test-utils.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index b81456075..21e092e95 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -70,7 +70,8 @@ describe('loading:', function () { }); }); - afterEach(async function() { + afterEach(async function () { + console.log('loading: afterEach'); if (parentDiv) { ReactDOM.unmountComponentAtNode(parentDiv); parentDiv.remove(); diff --git a/test/test-utils.js b/test/test-utils.js index a1c1cd0ad..3c697661e 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -38,12 +38,12 @@ export function deleteIndexedDB(dbName) { const req = window.indexedDB.deleteDatabase(dbName); req.onblocked = () => { - console.log(`can't yet delete indexeddb because it is open elsewhere`); + console.log(`can't yet delete indexeddb ${dbName} because it is open elsewhere`); }; req.onerror = (ev) => { reject(new Error( - "unable to delete indexeddb: " + ev.target.error, + `unable to delete indexeddb ${dbName}: ${ev.target.error}`, )); }; @@ -51,5 +51,8 @@ export function deleteIndexedDB(dbName) { console.log(`Removed indexeddb instance: ${dbName}`); resolve(); }; + }).catch((e) => { + console.error(`Error removing indexeddb instance ${dbName}: ${e}`); + throw e; }); } From c4a3211cfc42ed42b003c08eda5a524e82a6296e Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 20 Jun 2017 16:28:40 +0100 Subject: [PATCH 07/13] Use _tJsx for PasswordNagBar (because it has ) --- src/components/views/globals/PasswordNagBar.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/views/globals/PasswordNagBar.js b/src/components/views/globals/PasswordNagBar.js index 56eb7bd76..873cefe16 100644 --- a/src/components/views/globals/PasswordNagBar.js +++ b/src/components/views/globals/PasswordNagBar.js @@ -20,7 +20,7 @@ import React from 'react'; import sdk from 'matrix-react-sdk'; import Modal from 'matrix-react-sdk/lib/Modal'; import dis from 'matrix-react-sdk/lib/dispatcher'; -import { _t } from 'matrix-react-sdk/lib/languageHandler'; +import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler'; export default React.createClass({ onUpdateClicked: function() { @@ -49,7 +49,11 @@ export default React.createClass({ alt="Warning" />
- { _t("To return to your account in future you need to set a password") } + { _tJsx( + "To return to your account in future you need to set a password", + /(.*?)<\/u>/, + (sub) => { return { sub }; }, + ) }