From 6a6118e136776ce27c2e7456dd517df083dba493 Mon Sep 17 00:00:00 2001 From: Jason Papakostas Date: Tue, 24 May 2016 19:08:09 -0500 Subject: [PATCH 01/31] serve config.json statically instead of bundling it issue #1344 --- package.json | 1 + src/vector/index.js | 26 +++++++++++++++++++++++--- vector/config.json | 1 + 3 files changed, 25 insertions(+), 3 deletions(-) create mode 120000 vector/config.json diff --git a/package.json b/package.json index c2400cedf..0da702490 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ }, "dependencies": { "babel-polyfill": "^6.5.0", + "browser-request": "^0.3.3", "classnames": "^2.1.2", "extract-text-webpack-plugin": "^0.9.1", "filesize": "^3.1.2", diff --git a/src/vector/index.js b/src/vector/index.js index db353c250..af48b4b07 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -40,8 +40,9 @@ var ReactDOM = require("react-dom"); var sdk = require("matrix-react-sdk"); sdk.loadSkin(require('../component-index')); var VectorConferenceHandler = require('../VectorConferenceHandler'); -var configJson = require("../../config.json"); var UpdateChecker = require("./updater"); +var q = require('q'); +var request = require('browser-request'); var qs = require("querystring"); @@ -181,7 +182,24 @@ window.onload = function() { } } -function loadApp() { +function getConfig() { + let deferred = q.defer(); + + request( + { method: "GET", url: "config.json", json: true }, + (err, response, body) => { + if (err || response.status < 200 || response.status >= 300) { + throw "failed to load config.json"; + } + + deferred.resolve(body); + } + ); + + return deferred.promise; +} + +async function loadApp() { if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) { if (confirm("Vector works much better on iOS as an app. Switch to the app?")) { window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067"; @@ -194,7 +212,9 @@ function loadApp() { return; } } - + + let configJson = await getConfig(); + console.log("Vector starting at "+window.location); if (validBrowser) { var MatrixChat = sdk.getComponent('structures.MatrixChat'); diff --git a/vector/config.json b/vector/config.json new file mode 120000 index 000000000..28e148537 --- /dev/null +++ b/vector/config.json @@ -0,0 +1 @@ +../config.json \ No newline at end of file From 12157edd624ea2287b3442b576848d4c386966d6 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Sat, 28 May 2016 12:20:21 +0530 Subject: [PATCH 02/31] Style selection color --- src/skins/vector/css/common.css | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/skins/vector/css/common.css b/src/skins/vector/css/common.css index f179a20f6..c22a7def0 100644 --- a/src/skins/vector/css/common.css +++ b/src/skins/vector/css/common.css @@ -228,3 +228,13 @@ input[type=text]:focus, textarea:focus { height: 1em; vertical-align: middle; } + +::-moz-selection { + background-color: #76CFA6; + color: white; +} + +::selection { + background-color: #76CFA6; + color: white; +} From 1902b631c75a8b144517c82023d8d024aa106f0d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 11:45:23 +0100 Subject: [PATCH 03/31] add default branding parameter for email notifs --- config.json | 1 + 1 file changed, 1 insertion(+) diff --git a/config.json b/config.json index e1024d0b7..e69cf06cf 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,7 @@ { "default_hs_url": "https://matrix.org", "default_is_url": "https://vector.im", + "brand": "Vector", "integrations_ui_url": "http://localhost:8081/", "integrations_rest_url": "http://localhost:5050" } From d976046e6ad83eff51562168d0da92eebb715ca4 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 13:15:13 +0100 Subject: [PATCH 04/31] set email branding whenever emails are added from vector --- config.json | 4 ++-- src/components/views/settings/Notifications.js | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index e69cf06cf..7a8661893 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { - "default_hs_url": "https://matrix.org", + "default_hs_url": "http://127.0.0.1:8008", "default_is_url": "https://vector.im", "brand": "Vector", - "integrations_ui_url": "http://localhost:8081/", + "integrations_ui_url": "http://localhost:5051/", "integrations_rest_url": "http://localhost:5050" } diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index a9ff9c0e5..8b283191e 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -21,6 +21,7 @@ var sdk = require('matrix-react-sdk'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var UserSettingsStore = require('matrix-react-sdk/lib/UserSettingsStore'); var Modal = require('matrix-react-sdk/lib/Modal'); +var configJson = require("../../../../config.json"); var notifications = require('../../../notifications'); @@ -116,7 +117,11 @@ module.exports = React.createClass({ onEnableEmailNotificationsChange: function(address, event) { var emailPusherPromise; if (event.target.checked) { - emailPusherPromise = UserSettingsStore.addEmailPusher(address); + var data = {} + if (configJson.brand) { + data['brand'] = configJson.brand; + } + emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); } else { var emailPusher = UserSettingsStore.getEmailPusher(this.state.pushers, address); emailPusher.kind = null; From f6ec858ac9f524dd36d11c58015841cd47ec956e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 2 Jun 2016 13:39:52 +0100 Subject: [PATCH 05/31] Bump js-sdk and react-sdk for new releases js-sdk 0.5.3 react-sdk 0.6.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c2400cedf..ef0e2bb54 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "^0.5.2", - "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", + "matrix-js-sdk": "^0.5.3", + "matrix-react-sdk": "^0.6.0", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.0.1", From a53acb3b58391700cfd7ef4a0eb3a538365b3738 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 2 Jun 2016 13:42:24 +0100 Subject: [PATCH 06/31] Prepare changelog for v0.7.0 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f94f797a..435bb491e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +Changes in [0.7.0](https://github.com/vector-im/vector-web/releases/tag/v0.7.0) (2016-06-02) +============================================================================================ +[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.6.1...v0.7.0) + + * Update to matrix-react-sdk 0.6.0 - see + [changelog](https://github.com/matrix-org/matrix-react-sdk/blob/v0.6.0/CHANGELOG.md) + * Style selection color. + [\#1557](https://github.com/vector-im/vector-web/pull/1557) + * Fix NPE when loading the Settings page which infini-spinnered + [\#1518](https://github.com/vector-im/vector-web/pull/1518) + * Add option to enable email notifications + [\#1469](https://github.com/vector-im/vector-web/pull/1469) + Changes in [0.6.1](https://github.com/vector-im/vector-web/releases/tag/v0.6.1) (2016-04-22) ============================================================================================ [Full Changelog](https://github.com/vector-im/vector-web/compare/v0.6.0...v0.6.1) From e0bf23fa7cc00d488a4f85c33c9d4fa0a6183e41 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 2 Jun 2016 13:42:25 +0100 Subject: [PATCH 07/31] 0.7.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef0e2bb54..7c1b2b765 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vector-web", - "version": "0.6.1", + "version": "0.7.0", "description": "Vector webapp", "author": "matrix.org", "repository": { From cadedd29191f2a8f6c4d11039e5148b1efcf7d77 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 2 Jun 2016 14:24:36 +0100 Subject: [PATCH 08/31] Revert presumably accidentally comitted config.json --- config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.json b/config.json index 7a8661893..e69cf06cf 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { - "default_hs_url": "http://127.0.0.1:8008", + "default_hs_url": "https://matrix.org", "default_is_url": "https://vector.im", "brand": "Vector", - "integrations_ui_url": "http://localhost:5051/", + "integrations_ui_url": "http://localhost:8081/", "integrations_rest_url": "http://localhost:5050" } From 481a7b160d4dd79e014f15ba906676e5e2ab36e9 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 18:41:20 +0100 Subject: [PATCH 09/31] Prepare changelog for v0.7.1 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 435bb491e..2e7b90464 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [0.7.1](https://github.com/vector-im/vector-web/releases/tag/v0.7.1) (2016-06-02) +============================================================================================ +[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.0...v0.7.1) + + * Fix accidentally committed local changes to the default config.json (doh!) + Changes in [0.7.0](https://github.com/vector-im/vector-web/releases/tag/v0.7.0) (2016-06-02) ============================================================================================ [Full Changelog](https://github.com/vector-im/vector-web/compare/v0.6.1...v0.7.0) From 635fd927cd185a567df6997bb3fe32f4719b9318 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 18:41:20 +0100 Subject: [PATCH 10/31] 0.7.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c1b2b765..f0552dc5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vector-web", - "version": "0.7.0", + "version": "0.7.1", "description": "Vector webapp", "author": "matrix.org", "repository": { From 4ec77eeca704d1ebd97cc0bc438671d86e4b589c Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 19:04:22 +0100 Subject: [PATCH 11/31] correctly bump dep on js-sdk and react-sdk --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index f0552dc5f..48155c81c 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "^0.5.3", - "matrix-react-sdk": "^0.6.0", + "matrix-js-sdk": "^0.5.4", + "matrix-react-sdk": "^0.6.2", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.0.1", From 1a11c402fa37647de49004da435019f9e5897208 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 19:05:50 +0100 Subject: [PATCH 12/31] Prepare changelog for v0.7.2 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7b90464..7df8eb808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [0.7.2](https://github.com/vector-im/vector-web/releases/tag/v0.7.2) (2016-06-02) +============================================================================================ +[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.1...v0.7.2) + + * Correctly bump the dep on new matrix-js-sdk and matrix-react-sdk + Changes in [0.7.1](https://github.com/vector-im/vector-web/releases/tag/v0.7.1) (2016-06-02) ============================================================================================ [Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.0...v0.7.1) From ded66bbdfc3ad02afc529d6f6b6228a374e87193 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 19:05:50 +0100 Subject: [PATCH 13/31] 0.7.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 48155c81c..c88edd6eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vector-web", - "version": "0.7.1", + "version": "0.7.2", "description": "Vector webapp", "author": "matrix.org", "repository": { From ddc4ac187c1daafe90608da4e8d03d9319460985 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 2 Jun 2016 23:32:47 +0100 Subject: [PATCH 14/31] dep on react-sdk develop --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c88edd6eb..9edf390f4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", "matrix-js-sdk": "^0.5.4", - "matrix-react-sdk": "^0.6.2", + "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.0.1", From e68a2b5e1db796bf3aa69d5af744c8863320aef3 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 3 Jun 2016 12:19:04 +0100 Subject: [PATCH 15/31] pin to react sdk 0.6.3 for release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9edf390f4..9311ec106 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", "matrix-js-sdk": "^0.5.4", - "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", + "matrix-react-sdk": "^0.6.3", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.0.1", From 7ab2449ac18263c528082a8f35fea2ba803964a8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 3 Jun 2016 12:20:04 +0100 Subject: [PATCH 16/31] Prepare changelog for v0.7.3 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df8eb808..94ad46028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Changes in [0.7.3](https://github.com/vector-im/vector-web/releases/tag/v0.7.3) (2016-06-03) +============================================================================================ +[Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.2...v0.7.3) + +* Update to react-sdk 0.6.3 + Changes in [0.7.2](https://github.com/vector-im/vector-web/releases/tag/v0.7.2) (2016-06-02) ============================================================================================ [Full Changelog](https://github.com/vector-im/vector-web/compare/v0.7.1...v0.7.2) From c672919d1e869004d2e9df0adecc328e99930624 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 3 Jun 2016 12:20:05 +0100 Subject: [PATCH 17/31] 0.7.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9311ec106..5218be1a1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vector-web", - "version": "0.7.2", + "version": "0.7.3", "description": "Vector webapp", "author": "matrix.org", "repository": { From f9aaf7d9030ca46fe779d1485fdb5e5c45321fd1 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 6 Jun 2016 19:13:30 +0100 Subject: [PATCH 18/31] Use the SdkConfig interface rather than pulling in config.json directly. json-loader appears to still be necessary due to some horrendous json dependency in the depths of sanitize-html. --- src/components/views/settings/Notifications.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 8b283191e..359802417 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -21,7 +21,7 @@ var sdk = require('matrix-react-sdk'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var UserSettingsStore = require('matrix-react-sdk/lib/UserSettingsStore'); var Modal = require('matrix-react-sdk/lib/Modal'); -var configJson = require("../../../../config.json"); +var SdkConfig = require("matrix-react-sdk/lib/SdkConfig"); var notifications = require('../../../notifications'); @@ -118,8 +118,8 @@ module.exports = React.createClass({ var emailPusherPromise; if (event.target.checked) { var data = {} - if (configJson.brand) { - data['brand'] = configJson.brand; + if (SdkConfig.get().brand) { + data['brand'] = SdkConfig.get().brand; } emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); } else { From ed1554f4afea11e0db60aea781bef872fe266ae8 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 7 Jun 2016 22:01:56 +0100 Subject: [PATCH 19/31] index.js: fix wording in android popup --- src/vector/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vector/index.js b/src/vector/index.js index 67ce24e6a..9ecf8f813 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -184,18 +184,18 @@ window.onload = function() { function getConfig() { let deferred = q.defer(); - + request( { method: "GET", url: "config.json", json: true }, (err, response, body) => { if (err || response.status < 200 || response.status >= 300) { throw "failed to load config.json"; } - + deferred.resolve(body); } ); - + return deferred.promise; } @@ -207,14 +207,14 @@ async function loadApp() { } } else if (/Android/.test(navigator.userAgent)) { - if (confirm("Vector runs much better as an app on Vector. Get the app?")) { + if (confirm("Vector runs much better as an app on Android. Get the app?")) { window.location = "https://play.google.com/store/apps/details?id=im.vector.alpha"; return; } } - + let configJson = await getConfig(); - + console.log("Vector starting at "+window.location); if (validBrowser) { var MatrixChat = sdk.getComponent('structures.MatrixChat'); From 1e40fd750fb104e652172cb854aa3a29b2542ef3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 8 Jun 2016 14:55:47 +0100 Subject: [PATCH 20/31] Don't use SdkConfig instead take brand from a prop --- src/components/views/settings/Notifications.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 359802417..771037863 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -21,7 +21,6 @@ var sdk = require('matrix-react-sdk'); var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg'); var UserSettingsStore = require('matrix-react-sdk/lib/UserSettingsStore'); var Modal = require('matrix-react-sdk/lib/Modal'); -var SdkConfig = require("matrix-react-sdk/lib/SdkConfig"); var notifications = require('../../../notifications'); @@ -73,6 +72,8 @@ module.exports = React.createClass({ propTypes: { // The array of threepids from the JS SDK (required for email notifications) threepids: React.PropTypes.array.isRequired, + // The brand string set when creating an email pusher + brand: React.PropTypes.string, }, getDefaultProps: function() { @@ -118,8 +119,8 @@ module.exports = React.createClass({ var emailPusherPromise; if (event.target.checked) { var data = {} - if (SdkConfig.get().brand) { - data['brand'] = SdkConfig.get().brand; + if (this.props.brand) { + data['brand'] = this.props.brand; } emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); } else { From e24851456aa42072f3e04db8436572f84fc48595 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 8 Jun 2016 17:03:28 +0100 Subject: [PATCH 21/31] CSS for the MemberDeviceInfo view --- .../views/rooms/MemberDeviceInfo.css | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/skins/vector/css/matrix-react-sdk/views/rooms/MemberDeviceInfo.css diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/MemberDeviceInfo.css b/src/skins/vector/css/matrix-react-sdk/views/rooms/MemberDeviceInfo.css new file mode 100644 index 000000000..86a304f6b --- /dev/null +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/MemberDeviceInfo.css @@ -0,0 +1,37 @@ +/* +Copyright 2016 OpenMarket Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +.mx_MemberDeviceInfo { + font-size: 12px; + margin-top: 5px; +} + +.mx_MemberDeviceInfo div { + display: inline; + margin-right: 5px; +} + +.mx_MemberDeviceInfo_textButton { + color: #fff; + background-color: #76cfa6; + height: 20px; + border-radius: 20px; + text-align: center; + padding-left: 1em; + padding-right: 1em; + + cursor: pointer; +} From 5f29729e82a10505ab90c492710989ca72c1e0fb Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 8 Jun 2016 17:03:54 +0100 Subject: [PATCH 22/31] Make unverified encrypted events red and verified ones green --- .../vector/css/matrix-react-sdk/views/rooms/EventTile.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/skins/vector/css/matrix-react-sdk/views/rooms/EventTile.css b/src/skins/vector/css/matrix-react-sdk/views/rooms/EventTile.css index 6c0218b53..cb71d481d 100644 --- a/src/skins/vector/css/matrix-react-sdk/views/rooms/EventTile.css +++ b/src/skins/vector/css/matrix-react-sdk/views/rooms/EventTile.css @@ -36,6 +36,14 @@ limitations under the License. margin-top: 8px ! important; } +.mx_EventTile_verified { + background-color: #eaf5f0; +} + +.mx_EventTile_unverified { + background-color: #ffa0a0; +} + .mx_EventTile .mx_SenderProfile { color: #454545; opacity: 0.5; From f6aa9a7ea48efda6a597ead25b1d0774de847dda Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 8 Jun 2016 18:46:21 +0100 Subject: [PATCH 23/31] Make the config optional Accept 404 errors from getting the config and start MatrixChat with no config, make other errors display a simple error message to prevent a completely blank page if the config does fail to load. --- .../views/settings/Notifications.js | 2 ++ src/vector/index.js | 24 ++++++++++++++++--- vector/config.json | 1 - config.json => vector/config.sample.json | 0 4 files changed, 23 insertions(+), 4 deletions(-) delete mode 120000 vector/config.json rename config.json => vector/config.sample.json (100%) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index 771037863..bd12bdf9c 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -121,6 +121,8 @@ module.exports = React.createClass({ var data = {} if (this.props.brand) { data['brand'] = this.props.brand; + } else if (this.props.brand === undefined) { + data['brand'] = 'Vector'; } emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); } else { diff --git a/src/vector/index.js b/src/vector/index.js index 9ecf8f813..c2e16108e 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -79,6 +79,7 @@ var validBrowser = checkBrowserFeatures([ "displaytable", "flexbox", "es5object", "es5function", "localstorage", "objectfit" ]); +var configError; // We want to support some name / value pairs in the fragment // so we're re-using query string like format @@ -112,6 +113,8 @@ function parseQs(location) { // Here, we do some crude URL analysis to allow // deep-linking. function routeUrl(location) { + if (!window.matrixChat) return; + console.log("Routing URL "+window.location); var params = parseQs(location); var loginToken = params.loginToken; @@ -189,7 +192,7 @@ function getConfig() { { method: "GET", url: "config.json", json: true }, (err, response, body) => { if (err || response.status < 200 || response.status >= 300) { - throw "failed to load config.json"; + deferred.reject({err: err, response: response}); } deferred.resolve(body); @@ -213,10 +216,25 @@ async function loadApp() { } } - let configJson = await getConfig(); + let configJson; + try { + configJson = await getConfig(); + } catch (e) { + // On 404 errors, carry on without a config, + // but on other errors, fail, otherwise it will + // lead to subtle errors where the app runs with + // the default config it fails to fetch config.json. + if (e.response.status != 404) { + configError = e; + } + } console.log("Vector starting at "+window.location); - if (validBrowser) { + if (configError) { + window.matrixChat = ReactDOM.render(
+ Unable to load config file: please refresh the page to try again. +
, document.getElementById('matrixchat')); + } else if (validBrowser) { var MatrixChat = sdk.getComponent('structures.MatrixChat'); var fragParts = parseQsFromFragment(window.location); window.matrixChat = ReactDOM.render( diff --git a/vector/config.json b/vector/config.json deleted file mode 120000 index 28e148537..000000000 --- a/vector/config.json +++ /dev/null @@ -1 +0,0 @@ -../config.json \ No newline at end of file diff --git a/config.json b/vector/config.sample.json similarity index 100% rename from config.json rename to vector/config.sample.json From 7999a70cabaf0f77f86e5e906dd81f7b10d2fe13 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 24 Mar 2016 17:39:49 +0000 Subject: [PATCH 24/31] Switch to dev versions of react-sdk and js-sdk --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 723d5533c..cfc90011e 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ "gfm.css": "^1.1.1", "highlight.js": "^9.0.0", "linkifyjs": "^2.0.0-beta.4", - "matrix-js-sdk": "^0.5.4", - "matrix-react-sdk": "^0.6.3", + "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", + "matrix-react-sdk": "matrix-org/matrix-react-sdk#develop", "modernizr": "^3.1.0", "q": "^1.4.1", "react": "^15.0.1", From 4fc311da90ab976e9df88b680b6f92b631f6e3b6 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jun 2016 09:56:11 +0100 Subject: [PATCH 25/31] Style fix --- src/components/views/settings/Notifications.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index bd12bdf9c..a69081184 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -120,9 +120,7 @@ module.exports = React.createClass({ if (event.target.checked) { var data = {} if (this.props.brand) { - data['brand'] = this.props.brand; - } else if (this.props.brand === undefined) { - data['brand'] = 'Vector'; + data['brand'] = this.props.brand || 'Vector'; } emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); } else { From e4ea00ca23f6d4e28340338787697cc6fe193621 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jun 2016 09:56:57 +0100 Subject: [PATCH 26/31] Return here, else we'll call resolve too --- src/vector/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vector/index.js b/src/vector/index.js index c2e16108e..e5850f41e 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -193,6 +193,7 @@ function getConfig() { (err, response, body) => { if (err || response.status < 200 || response.status >= 300) { deferred.reject({err: err, response: response}); + return; } deferred.resolve(body); From 3040d0a474832a629db5b4a329a9520187155328 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jun 2016 09:57:44 +0100 Subject: [PATCH 27/31] Comment typo --- src/vector/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/index.js b/src/vector/index.js index e5850f41e..4b4e3a953 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -224,7 +224,7 @@ async function loadApp() { // On 404 errors, carry on without a config, // but on other errors, fail, otherwise it will // lead to subtle errors where the app runs with - // the default config it fails to fetch config.json. + // the default config if fails to fetch config.json. if (e.response.status != 404) { configError = e; } From 24602119c5f20bb9df8b23294f78c08ca258c3a3 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jun 2016 09:59:37 +0100 Subject: [PATCH 28/31] This doesn't actually need to be global (because the rendering isn't in a render method here) --- src/vector/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/index.js b/src/vector/index.js index 4b4e3a953..9f98cf971 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -79,7 +79,6 @@ var validBrowser = checkBrowserFeatures([ "displaytable", "flexbox", "es5object", "es5function", "localstorage", "objectfit" ]); -var configError; // We want to support some name / value pairs in the fragment // so we're re-using query string like format @@ -218,6 +217,7 @@ async function loadApp() { } let configJson; + let configError; try { configJson = await getConfig(); } catch (e) { From f595f6f141f2c417f494be55393d1cf3916429bb Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jun 2016 10:25:49 +0100 Subject: [PATCH 29/31] This check shouldn't be here with the || --- src/components/views/settings/Notifications.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/views/settings/Notifications.js b/src/components/views/settings/Notifications.js index a69081184..7f0b57545 100644 --- a/src/components/views/settings/Notifications.js +++ b/src/components/views/settings/Notifications.js @@ -119,9 +119,7 @@ module.exports = React.createClass({ var emailPusherPromise; if (event.target.checked) { var data = {} - if (this.props.brand) { - data['brand'] = this.props.brand || 'Vector'; - } + data['brand'] = this.props.brand || 'Vector'; emailPusherPromise = UserSettingsStore.addEmailPusher(address, data); } else { var emailPusher = UserSettingsStore.getEmailPusher(this.state.pushers, address); From 4dd477e064023895633e52597457f03d8989ce9c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 9 Jun 2016 10:38:51 +0100 Subject: [PATCH 30/31] index.js: fix comment typo Fix dave's typo for him --- src/vector/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/index.js b/src/vector/index.js index 9f98cf971..08d89c3de 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -224,7 +224,7 @@ async function loadApp() { // On 404 errors, carry on without a config, // but on other errors, fail, otherwise it will // lead to subtle errors where the app runs with - // the default config if fails to fetch config.json. + // the default config if it fails to fetch config.json. if (e.response.status != 404) { configError = e; } From b7f1a3db5755e096a36eaf47b1a06f6fcea1b617 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jun 2016 18:51:25 +0100 Subject: [PATCH 31/31] gitignore config.json now it isn't versioned --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index df91879d0..5b2b6dafb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /packages/ /vector/bundle.* /vector/components.css +/vector/config.json