From 50baa09f5e7251049cebc336165a98c45a53c041 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 10:06:44 +0000 Subject: [PATCH 1/7] Revert "Disable even more tests" This was only done because CI was missing matrix-org/matrix-react-sdk@5977859dd98960189e65f34abc2832d281ec48de. This reverts commit e55ceef9055a82f9dcf706dc92db856ce4dadb5f. --- test/app-tests/loading.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index b165e5d3c2..060c8f8ad6 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -222,8 +222,7 @@ describe('loading:', function() { }).done(done, done); }); - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('should follow the original link after successful login', function(done) { + it('should follow the original link after successful login', function(done) { loadApp({ uriFragment: "#/room/!room:id", }); @@ -258,10 +257,9 @@ describe('loading:', function() { expect(localStorage.getItem('mx_hs_url')).toEqual(DEFAULT_HS_URL); expect(localStorage.getItem('mx_is_url')).toEqual(DEFAULT_IS_URL); }).done(done, done); - }); */ + }); - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('should not register as a guest when using a #/login link', function() { + it('should not register as a guest when using a #/login link', function() { loadApp({ uriFragment: "#/login", }); @@ -288,7 +286,7 @@ describe('loading:', function() { matrixChat, sdk.getComponent('structures.EmbeddedPage')); expect(windowLocation.hash).toEqual("#/home"); }); - }); */ + }); }); describe("MatrixClient rehydrated from stored credentials:", function() { @@ -300,8 +298,7 @@ describe('loading:', function() { localStorage.setItem("mx_last_room_id", "!last_room:id"); }); - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('shows the last known room by default', function() { + it('shows the last known room by default', function() { httpBackend.when('GET', '/pushrules').respond(200, {}); httpBackend.when('POST', '/filter').respond(200, { filter_id: 'fid' }); @@ -357,7 +354,7 @@ describe('loading:', function() { httpBackend.verifyNoOutstandingExpectation(); expect(windowLocation.hash).toEqual("#/room/!room:id"); }).done(done, done); - }); */ + }); describe('/#/login link:', function() { beforeEach(function() { @@ -387,8 +384,7 @@ describe('loading:', function() { } }); - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('shows the homepage after login', function() { + it('shows the homepage after login', function() { return completeLogin(matrixChat).then(() => { // we should see a home page, even though we previously had // a stored mx_last_room_id @@ -396,7 +392,7 @@ describe('loading:', function() { matrixChat, sdk.getComponent('structures.EmbeddedPage')); expect(windowLocation.hash).toEqual("#/home"); }); - }); */ + }); }); }); From 6aff7460feaa76e9fa5c4b2190f8bef95d99da8f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 11:17:40 +0000 Subject: [PATCH 2/7] Map welcome page in Karma for less 404s --- karma.conf.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/karma.conf.js b/karma.conf.js index d982aa2421..ae666a455b 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -78,7 +78,7 @@ module.exports = function (config) { watched: false, included: false, served: true, nocache: false, }, { - pattern: 'res/themes/**', + pattern: 'res/**', watched: false, included: false, served: true, nocache: false, }, ], @@ -87,6 +87,8 @@ module.exports = function (config) { // redirect img links to the karma server. See above. "/img/": "/base/node_modules/matrix-react-sdk/res/img/", "/themes/": "/base/res/themes/", + "/welcome.html": "/base/res/welcome.html", + "/welcome/": "/base/res/welcome/", }, // preprocess matching files before serving them to the browser From 585d28692dc37b1228c57219c9a24601b39f2056 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 15:18:29 +0000 Subject: [PATCH 3/7] Fix loading tests for welcome page --- test/app-tests/loading.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/test/app-tests/loading.js b/test/app-tests/loading.js index 060c8f8ad6..aa7fe58fa2 100644 --- a/test/app-tests/loading.js +++ b/test/app-tests/loading.js @@ -397,8 +397,7 @@ describe('loading:', function() { }); describe('Guest auto-registration:', function() { - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('shows a welcome page by default', function(done) { + it('shows a welcome page by default', function(done) { loadApp(); Promise.delay(1).then(() => { @@ -426,10 +425,9 @@ describe('loading:', function() { matrixChat, sdk.getComponent('auth.Welcome')); expect(windowLocation.hash).toEqual("#/welcome"); }).done(done, done); - }); */ + }); - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('uses the default homeserver to register with', function(done) { + it('uses the default homeserver to register with', function(done) { loadApp(); Promise.delay(1).then(() => { @@ -453,15 +451,15 @@ describe('loading:', function() { }).then((req) => { expect(req.path).toStartWith(DEFAULT_HS_URL); - // once the sync completes, we should have a home page + // once the sync completes, we should have a welcome page httpBackend.verifyNoOutstandingExpectation(); ReactTestUtils.findRenderedComponentWithType( - matrixChat, sdk.getComponent('structures.EmbeddedPage')); - expect(windowLocation.hash).toEqual("#/home"); + matrixChat, sdk.getComponent('auth.Welcome')); + expect(windowLocation.hash).toEqual("#/welcome"); expect(MatrixClientPeg.get().baseUrl).toEqual(DEFAULT_HS_URL); expect(MatrixClientPeg.get().idBaseUrl).toEqual(DEFAULT_IS_URL); }).done(done, done); - }); */ + }); it('shows a room view if we followed a room link', function(done) { loadApp({ @@ -530,15 +528,14 @@ describe('loading:', function() { }); }); - // TODO: Repair this test in https://github.com/vector-im/riot-web/issues/8468 - /* it('should give us a login page', function() { + it('should give us a login page', function() { expect(windowLocation.hash).toEqual("#/login"); // we expect a single component ReactTestUtils.findRenderedComponentWithType( matrixChat, sdk.getComponent('structures.auth.Login'), ); - }); */ + }); /* // ILAG renders this obsolete. I think. @@ -680,8 +677,6 @@ function awaitSyncingSpinner(matrixChat, retryLimit, retryCount) { console.log(Date.now() + " Awaiting sync spinner: load complete."); - // state looks good, check the rendered output - assertAtSyncingSpinner(matrixChat); return Promise.resolve(); } From aea2b1ebc97c546edbb77d5b3d38532b86c1fc4b Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 15:51:16 +0000 Subject: [PATCH 4/7] Convert VectorAuthPage to modern code style --- src/components/views/auth/VectorAuthPage.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/views/auth/VectorAuthPage.js b/src/components/views/auth/VectorAuthPage.js index e277cb18c8..0fc42f0ad6 100644 --- a/src/components/views/auth/VectorAuthPage.js +++ b/src/components/views/auth/VectorAuthPage.js @@ -16,17 +16,13 @@ limitations under the License. 'use strict'; -const React = require('react'); +import React from 'react'; import sdk from 'matrix-react-sdk/lib/index'; -module.exports = React.createClass({ - displayName: 'VectorAuthPage', +export default class VectorAuthPage extends React.PureComponent { + static replaces = 'AuthPage' - statics: { - replaces: 'AuthPage', - }, - - render: function() { + render() { const AuthFooter = sdk.getComponent('auth.AuthFooter'); const pageStyle = { @@ -66,5 +62,5 @@ module.exports = React.createClass({ ); - }, -}); + } +} From 86ced4cdad8006a6dfee89ffe5c82fb9698d42a2 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 16:07:39 +0000 Subject: [PATCH 5/7] Allow configuring welcome background image --- README.md | 3 +++ src/components/views/auth/VectorAuthPage.js | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d493287452..a7621aa618 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,9 @@ For a good example, see https://riot.im/develop/config.json release to release. 1. `brand`: String to pass to your homeserver when configuring email notifications, to let the homeserver know what email template to use when talking to you. +1. `branding`: Configures various branding and logo details, such as: + 1. `welcomeBackgroundUrl`: An image to use as a wallpaper outside the app + during authentication flows 1. `integrations_ui_url`: URL to the web interface for the integrations server. The integrations server is not Riot and normally not your homeserver either. The integration server settings may be left blank to disable integrations. diff --git a/src/components/views/auth/VectorAuthPage.js b/src/components/views/auth/VectorAuthPage.js index 0fc42f0ad6..bae685b951 100644 --- a/src/components/views/auth/VectorAuthPage.js +++ b/src/components/views/auth/VectorAuthPage.js @@ -18,6 +18,7 @@ limitations under the License. import React from 'react'; import sdk from 'matrix-react-sdk/lib/index'; +import SdkConfig from 'matrix-react-sdk/lib/SdkConfig'; export default class VectorAuthPage extends React.PureComponent { static replaces = 'AuthPage' @@ -25,8 +26,14 @@ export default class VectorAuthPage extends React.PureComponent { render() { const AuthFooter = sdk.getComponent('auth.AuthFooter'); + const brandingConfig = SdkConfig.get().branding; + let backgroundUrl = "themes/riot/img/backgrounds/valley.jpg"; + if (brandingConfig && brandingConfig.welcomeBackgroundUrl) { + backgroundUrl = brandingConfig.welcomeBackgroundUrl; + } + const pageStyle = { - background: 'center/cover fixed url(themes/riot/img/backgrounds/valley.jpg)', + background: `center/cover fixed url(${backgroundUrl})`, }; const modalStyle = { From 18d898cc1fe5852a8d325c3829722ba3e88ce81f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 16:14:34 +0000 Subject: [PATCH 6/7] Convert VectorAuthHeaderLogo to modern code style --- .../views/auth/VectorAuthHeaderLogo.js | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/components/views/auth/VectorAuthHeaderLogo.js b/src/components/views/auth/VectorAuthHeaderLogo.js index 7a40f44559..38d10044b3 100644 --- a/src/components/views/auth/VectorAuthHeaderLogo.js +++ b/src/components/views/auth/VectorAuthHeaderLogo.js @@ -22,20 +22,18 @@ import PropTypes from 'prop-types'; const LOGO_URI = "themes/riot/img/logos/riot-im-logo-black-text.svg"; -module.exports = React.createClass({ - displayName: 'VectorAuthHeaderLogo', - statics: { - replaces: 'AuthHeaderLogo', - }, - propTypes: { - icon: PropTypes.string, - }, +export default class VectorAuthHeaderLogo extends React.PureComponent { + static replaces = 'AuthHeaderLogo' - render: function() { + static propTypes = { + icon: PropTypes.string, + } + + render() { return (
Riot
); - }, -}); + } +} From 678904dcfbdaec12913ee8ab31ebd2cfe962163f Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Mon, 11 Feb 2019 16:23:22 +0000 Subject: [PATCH 7/7] Allow configuring auth header logo --- README.md | 2 ++ src/components/views/auth/VectorAuthHeaderLogo.js | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a7621aa618..b6451f82b7 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ For a good example, see https://riot.im/develop/config.json 1. `branding`: Configures various branding and logo details, such as: 1. `welcomeBackgroundUrl`: An image to use as a wallpaper outside the app during authentication flows + 1. `authHeaderLogoUrl`: An logo image that is shown in the header during + authentication flows 1. `integrations_ui_url`: URL to the web interface for the integrations server. The integrations server is not Riot and normally not your homeserver either. The integration server settings may be left blank to disable integrations. diff --git a/src/components/views/auth/VectorAuthHeaderLogo.js b/src/components/views/auth/VectorAuthHeaderLogo.js index 38d10044b3..0161fc3ffb 100644 --- a/src/components/views/auth/VectorAuthHeaderLogo.js +++ b/src/components/views/auth/VectorAuthHeaderLogo.js @@ -19,8 +19,7 @@ limitations under the License. import React from 'react'; import PropTypes from 'prop-types'; - -const LOGO_URI = "themes/riot/img/logos/riot-im-logo-black-text.svg"; +import SdkConfig from 'matrix-react-sdk/lib/SdkConfig'; export default class VectorAuthHeaderLogo extends React.PureComponent { static replaces = 'AuthHeaderLogo' @@ -30,9 +29,15 @@ export default class VectorAuthHeaderLogo extends React.PureComponent { } render() { + const brandingConfig = SdkConfig.get().branding; + let logoUrl = "themes/riot/img/logos/riot-im-logo-black-text.svg"; + if (brandingConfig && brandingConfig.authHeaderLogoUrl) { + logoUrl = brandingConfig.authHeaderLogoUrl; + } + return (
- Riot + Riot
); }