Merge branch 'develop' into matthew/dharma

This commit is contained in:
Matthew Hodgson 2018-08-03 17:15:00 -07:00
commit 4fbf34e05b
15 changed files with 213 additions and 6983 deletions

View file

@ -98,6 +98,7 @@ const LoggedInView = React.createClass({
this._setStateFromSessionStore();
this._matrixClient.on("accountData", this.onAccountData);
this._matrixClient.on("sync", this.onSync);
},
componentWillUnmount: function() {
@ -142,6 +143,20 @@ const LoggedInView = React.createClass({
}
},
onSync: function(syncState, oldSyncState, data) {
if (syncState === oldSyncState) return;
if (syncState === 'ERROR') {
this.setState({
syncErrorData: data,
});
} else {
this.setState({
syncErrorData: null,
});
}
},
_onKeyDown: function(ev) {
/*
// Remove this for now as ctrl+alt = alt-gr so this breaks keyboards which rely on alt-gr for numbers
@ -259,15 +274,15 @@ const LoggedInView = React.createClass({
// When the panels are disabled, clicking on them results in a mouse event
// which bubbles to certain elements in the tree. When this happens, close
// any settings page that is currently open (user/room/group).
if (this.props.leftDisabled &&
this.props.rightDisabled &&
(
ev.target.className === 'mx_MatrixChat' ||
ev.target.className === 'mx_MatrixChat_middlePanel' ||
ev.target.className === 'mx_RoomView'
)
) {
dis.dispatch({ action: 'close_settings' });
if (this.props.leftDisabled && this.props.rightDisabled) {
const targetClasses = new Set(ev.target.className.split(' '));
if (
targetClasses.has('mx_MatrixChat') ||
targetClasses.has('mx_MatrixChat_middlePanel') ||
targetClasses.has('mx_RoomView')
) {
dis.dispatch({ action: 'close_settings' });
}
}
},
@ -286,6 +301,7 @@ const LoggedInView = React.createClass({
const NewVersionBar = sdk.getComponent('globals.NewVersionBar');
const UpdateCheckBar = sdk.getComponent('globals.UpdateCheckBar');
const PasswordNagBar = sdk.getComponent('globals.PasswordNagBar');
const ServerLimitBar = sdk.getComponent('globals.ServerLimitBar');
let page_element;
let right_panel = '';
@ -370,7 +386,9 @@ const LoggedInView = React.createClass({
let topBar;
const isGuest = this.props.matrixClient.isGuest();
if (this.props.showCookieBar &&
if (this.state.syncErrorData && this.state.syncErrorData.error.errcode === 'M_MAU_LIMIT_EXCEEDED') {
topBar = <ServerLimitBar />;
} else if (this.props.showCookieBar &&
this.props.config.piwik
) {
const policyUrl = this.props.config.piwik.policyUrl || null;

View file

@ -309,10 +309,14 @@ module.exports = React.createClass({
);
} else {
let consentError = null;
let mauError = null;
for (const m of unsentMessages) {
if (m.error && m.error.errcode === 'M_CONSENT_NOT_GIVEN') {
consentError = m.error;
break;
} else if (m.error && m.error.errcode === 'M_MAU_LIMIT_EXCEEDED') {
mauError = m.error;
break;
}
}
if (consentError) {
@ -327,6 +331,8 @@ module.exports = React.createClass({
</a>,
},
);
} else if (mauError) {
title = _t("Your message wasnt sent because this homeserver has hit its Monthly Active User Limit. Please contact your service administrator to continue using the service.");
} else if (
unsentMessages.length === 1 &&
unsentMessages[0].error &&

View file

@ -121,6 +121,15 @@ module.exports = React.createClass({
const usingEmail = username.indexOf("@") > 0;
if (error.httpStatus === 400 && usingEmail) {
errorText = _t('This Home Server does not support login using email address.');
} else if (error.errcode == 'M_MAU_LIMIT_EXCEEDED') {
errorText = (
<div>
<div>{ _t('This homeserver has hit its Monthly Active User limit') }</div>
<div className="mx_Login_smallError">
{ _t('Please contact your service administrator to continue using this service.') }
</div>
</div>
);
} else if (error.httpStatus === 401 || error.httpStatus === 403) {
if (SdkConfig.get()['disable_custom_urls']) {
errorText = (

View file

@ -164,7 +164,12 @@ module.exports = React.createClass({
if (!success) {
let msg = response.message || response.toString();
// can we give a better error message?
if (response.required_stages && response.required_stages.indexOf('m.login.msisdn') > -1) {
if (response.errcode == 'M_MAU_LIMIT_EXCEEDED') {
msg = <div>
<p>{_t("This homeserver has hit its Monthly Active User limit")}</p>
<p>{_t("Please contact your service administrator to continue using this service.")}</p>
</div>;
} else if (response.required_stages && response.required_stages.indexOf('m.login.msisdn') > -1) {
let msisdnAvailable = false;
for (const flow of response.available_flows) {
msisdnAvailable |= flow.stages.indexOf('m.login.msisdn') > -1;