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

Commit daa0ddd

Browse files
authored
Merge pull request #2306 from matrix-org/travis/cors-on-join
Suppress CORS errors in the 'failed to join room' dialog
2 parents c06d42d + c46bae5 commit daa0ddd

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/i18n/strings/en_EN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@
222222
"Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions",
223223
"Not a valid Riot keyfile": "Not a valid Riot keyfile",
224224
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
225+
"There was an error joining the room": "There was an error joining the room",
225226
"Use a few words, avoid common phrases": "Use a few words, avoid common phrases",
226227
"No need for symbols, digits, or uppercase letters": "No need for symbols, digits, or uppercase letters",
227228
"Use a longer keyboard pattern with more turns": "Use a longer keyboard pattern with more turns",

src/stores/RoomViewStore.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ class RoomViewStore extends Store {
224224
err: err,
225225
});
226226
let msg = err.message ? err.message : JSON.stringify(err);
227+
// XXX: We are relying on the error message returned by browsers here.
228+
// This isn't great, but it does generalize the error being shown to users.
229+
if (msg && msg.startsWith("CORS request rejected")) {
230+
msg = _t("There was an error joining the room");
231+
}
227232
if (err.errcode === 'M_INCOMPATIBLE_ROOM_VERSION') {
228233
msg = <div>
229234
{_t("Sorry, your homeserver is too old to participate in this room.")}<br />

0 commit comments

Comments
 (0)