Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Weblate committed Feb 13, 2019
2 parents 3cec252 + 76f21ab commit 8e2529f
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 50 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ 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. `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.
Expand Down
4 changes: 3 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
],
Expand All @@ -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
Expand Down
27 changes: 15 additions & 12 deletions src/components/views/auth/VectorAuthHeaderLogo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,26 @@ limitations under the License.

import React from 'react';
import PropTypes from 'prop-types';
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';

const LOGO_URI = "themes/riot/img/logos/riot-im-logo-black-text.svg";
export default class VectorAuthHeaderLogo extends React.PureComponent {
static replaces = 'AuthHeaderLogo'

module.exports = React.createClass({
displayName: 'VectorAuthHeaderLogo',
statics: {
replaces: 'AuthHeaderLogo',
},
propTypes: {
static propTypes = {
icon: PropTypes.string,
},
}

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;
}

render: function() {
return (
<div className="mx_AuthHeaderLogo">
<img src={LOGO_URI} alt="Riot" />
<img src={logoUrl} alt="Riot" />
</div>
);
},
});
}
}
25 changes: 14 additions & 11 deletions src/components/views/auth/VectorAuthPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ limitations under the License.

'use strict';

const React = require('react');
import React from 'react';
import sdk from 'matrix-react-sdk/lib/index';
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';

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 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 = {
Expand Down Expand Up @@ -66,5 +69,5 @@ module.exports = React.createClass({
<AuthFooter />
</div>
);
},
});
}
}
43 changes: 17 additions & 26 deletions test/app-tests/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
Expand Down Expand Up @@ -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",
});
Expand All @@ -288,7 +286,7 @@ describe('loading:', function() {
matrixChat, sdk.getComponent('structures.EmbeddedPage'));
expect(windowLocation.hash).toEqual("#/home");
});
}); */
});
});

describe("MatrixClient rehydrated from stored credentials:", function() {
Expand All @@ -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' });

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -387,22 +384,20 @@ 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
ReactTestUtils.findRenderedComponentWithType(
matrixChat, sdk.getComponent('structures.EmbeddedPage'));
expect(windowLocation.hash).toEqual("#/home");
});
}); */
});
});
});

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(() => {
Expand Down Expand Up @@ -430,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(() => {
Expand All @@ -457,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({
Expand Down Expand Up @@ -534,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 <Login> component
ReactTestUtils.findRenderedComponentWithType(
matrixChat, sdk.getComponent('structures.auth.Login'),
);
}); */
});

/*
// ILAG renders this obsolete. I think.
Expand Down Expand Up @@ -684,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();
}

Expand Down

0 comments on commit 8e2529f

Please sign in to comment.