Support MAU error on sync

For https://github.com/vector-im/riot-web/issues/7091
This commit is contained in:
David Baker 2018-08-03 14:54:52 +01:00
parent bc1d359398
commit b5d2fa769c
5 changed files with 30 additions and 2 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
@ -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;