Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Suppress CORS errors in the 'failed to join room' dialog
Browse files Browse the repository at this point in the history
This isn't pretty, but it does address element-hq/element-web#7526

Tested with Chrome and Firefox to ensure the message is stable enough to parse.
  • Loading branch information
turt2live committed Nov 27, 2018
1 parent 0c6e985 commit 2b027b7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
"Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions",
"Not a valid Riot keyfile": "Not a valid Riot keyfile",
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
"There was an error joining the room": "There was an error joining the room",
"Sorry, your homeserver is too old to participate in this room.": "Sorry, your homeserver is too old to participate in this room.",
"Please contact your homeserver administrator.": "Please contact your homeserver administrator.",
"Failed to join room": "Failed to join room",
Expand Down
3 changes: 3 additions & 0 deletions src/stores/RoomViewStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ class RoomViewStore extends Store {
err: err,
});
let msg = err.message ? err.message : JSON.stringify(err);
if (msg && msg.startsWith("CORS request rejected")) {
msg = _t("There was an error joining the room");
}
if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') {
msg = <div>
{_t("Sorry, your homeserver is too old to participate in this room.")}<br />
Expand Down

0 comments on commit 2b027b7

Please sign in to comment.