Shift to M_RESOURCE_LIMIT_EXCEEDED errors

With support for admin_contact and limit_type fields

For https://github.com/vector-im/riot-web/issues/7091
This commit is contained in:
David Baker 2018-08-15 17:03:54 +01:00
parent 4c69c8d0f1
commit 9bde468e30
6 changed files with 111 additions and 31 deletions

View file

@ -121,12 +121,24 @@ 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') {
} else if (error.errcode == 'M_RESOURCE_LIMIT_EXCEEDED') {
errorText = (
<div>
<div>{ _t('This homeserver has hit its Monthly Active User limit') }</div>
<div>{error.data.error ? error.data.error : _t("This server has exceeded its available resources")}</div>
<div className="mx_Login_smallError">
{ _t('Please contact your service administrator to continue using this service.') }
{_t(
"Please <a>contact your service administrator</a> to continue using this service.",
{},
{
a: (sub) => {
if (error.data.admin_contact) {
return <a rel="noopener" target="_blank" href={error.data.admin_contact}>{sub}</a>;
} else {
return sub;
}
},
},
)}
</div>
</div>
);