Skip to content

Commit

Permalink
Handle M_UNSUPPORTED_ROOM_VERSION in invites and room creation
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Apr 10, 2019
1 parent 687b43f commit d755263
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/createRoom.js
Expand Up @@ -122,9 +122,16 @@ function createRoom(opts) {
action: 'join_room_error',
});
console.error("Failed to create room " + roomId + " " + err);
let description = _t("Server may be unavailable, overloaded, or you hit a bug.");
if (err.errcode === "M_UNSUPPORTED_ROOM_VERSION") {
// Technically not possible with the UI as of April 2019 because there's no
// options for the user to change this. However, it's not a bad thing to report
// the error to the user for if/when the UI is available.
description = _t("The server does not support the room version specified.");
}
Modal.createTrackedDialog('Failure to create room', '', ErrorDialog, {
title: _t("Failure to create room"),
description: _t("Server may be unavailable, overloaded, or you hit a bug."),
description,
});
return null;
});
Expand Down
7 changes: 5 additions & 2 deletions src/i18n/strings/en_EN.json
Expand Up @@ -47,8 +47,9 @@
"The file '%(fileName)s' failed to upload.": "The file '%(fileName)s' failed to upload.",
"The file '%(fileName)s' exceeds this homeserver's size limit for uploads": "The file '%(fileName)s' exceeds this homeserver's size limit for uploads",
"Upload Failed": "Upload Failed",
"Failure to create room": "Failure to create room",
"Server may be unavailable, overloaded, or you hit a bug.": "Server may be unavailable, overloaded, or you hit a bug.",
"The server does not support the room version specified.": "The server does not support the room version specified.",
"Failure to create room": "Failure to create room",
"Send anyway": "Send anyway",
"Send": "Send",
"Sun": "Sun",
Expand Down Expand Up @@ -258,6 +259,7 @@
"User %(user_id)s does not exist": "User %(user_id)s does not exist",
"User %(user_id)s may or may not exist": "User %(user_id)s may or may not exist",
"The user must be unbanned before they can be invited.": "The user must be unbanned before they can be invited.",
"The user's homeserver does not support the version of the room.": "The user's homeserver does not support the version of the room.",
"Unknown server error": "Unknown server error",
"Use a few words, avoid common phrases": "Use a few words, avoid common phrases",
"No need for symbols, digits, or uppercase letters": "No need for symbols, digits, or uppercase letters",
Expand Down Expand Up @@ -472,6 +474,7 @@
"All keys backed up": "All keys backed up",
"Backup has a signature from <verify>unknown</verify> device with ID %(deviceId)s.": "Backup has a signature from <verify>unknown</verify> device with ID %(deviceId)s.",
"Backup has a <validity>valid</validity> signature from this device": "Backup has a <validity>valid</validity> signature from this device",
"Backup has an <validity>invalid</validity> signature from this device": "Backup has an <validity>invalid</validity> signature from this device",
"Backup has a <validity>valid</validity> signature from <verify>verified</verify> device <device></device>": "Backup has a <validity>valid</validity> signature from <verify>verified</verify> device <device></device>",
"Backup has a <validity>valid</validity> signature from <verify>unverified</verify> device <device></device>": "Backup has a <validity>valid</validity> signature from <verify>unverified</verify> device <device></device>",
"Backup has an <validity>invalid</validity> signature from <verify>verified</verify> device <device></device>": "Backup has an <validity>invalid</validity> signature from <verify>verified</verify> device <device></device>",
Expand Down Expand Up @@ -958,7 +961,6 @@
"Join": "Join",
"No results": "No results",
"Communities": "Communities",
"Home": "Home",
"You cannot delete this image. (%(code)s)": "You cannot delete this image. (%(code)s)",
"Uploaded on %(date)s by %(user)s": "Uploaded on %(date)s by %(user)s",
"Rotate counter-clockwise": "Rotate counter-clockwise",
Expand Down Expand Up @@ -1272,6 +1274,7 @@
"Set a new status...": "Set a new status...",
"View Community": "View Community",
"Hide": "Hide",
"Home": "Home",
"Sign in": "Sign in",
"Login": "Login",
"powered by Matrix": "powered by Matrix",
Expand Down
2 changes: 2 additions & 0 deletions src/utils/MultiInviter.js
Expand Up @@ -178,6 +178,8 @@ export default class MultiInviter {
this._doInvite(address, true).then(resolve, reject);
} else if (err.errcode === "M_BAD_STATE") {
errorText = _t("The user must be unbanned before they can be invited.");
} else if (err.errcode === "M_UNSUPPORTED_ROOM_VERSION") {
errorText = _t("The user's homeserver does not support the version of the room.");
} else {
errorText = _t('Unknown server error');
}
Expand Down

0 comments on commit d755263

Please sign in to comment.