diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 96e721f7ca..46c1113a1d 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -996,10 +996,20 @@ export default React.createClass({ }, (err) => { modal.close(); console.error("Failed to leave room " + roomId + " " + err); + let title = _t("Failed to leave room"); + let message = _t("Server may be unavailable, overloaded, or you hit a bug."); + if (err.errcode == 'M_CANNOT_LEAVE_SERVER_NOTICE_ROOM') { + title = _t("Can't leave Server Notices room"); + message = _t( + "This room is used for important messages from the Homeserver, " + + "so you cannot leave it.", + ); + } else if (err && err.message) { + message = err.message; + } Modal.createTrackedDialog('Failed to leave room', '', ErrorDialog, { - title: _t("Failed to leave room"), - description: (err && err.message ? err.message : - _t("Server may be unavailable, overloaded, or you hit a bug.")), + title: title, + description: message, }); }); } diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index 0895ede636..018b6cb342 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -122,23 +122,32 @@ export default class AppTile extends React.Component { /** * Returns true if specified url is a scalar URL, typically https://scalar.vector.im/api - * @param {[type]} url URL to check + * @param {[type]} testUrlString URL to check * @return {Boolean} True if specified URL is a scalar URL */ - isScalarUrl(url) { - if (!url) { + isScalarUrl(testUrlString) { + if (!testUrlString) { console.error('Scalar URL check failed. No URL specified'); return false; } + const testUrl = url.parse(testUrlString); + let scalarUrls = SdkConfig.get().integrations_widgets_urls; if (!scalarUrls || scalarUrls.length == 0) { scalarUrls = [SdkConfig.get().integrations_rest_url]; } for (let i = 0; i < scalarUrls.length; i++) { - if (url.startsWith(scalarUrls[i])) { - return true; + const scalarUrl = url.parse(scalarUrls[i]); + if (testUrl && scalarUrl) { + if ( + testUrl.protocol === scalarUrl.protocol && + testUrl.host === scalarUrl.host && + testUrl.pathname.startsWith(scalarUrl.pathname) + ) { + return true; + } } } return false; @@ -269,7 +278,12 @@ export default class AppTile extends React.Component { event.origin = event.originalEvent.origin; } - if (!this.state.widgetUrl.startsWith(event.origin)) { + const widgetUrlObj = url.parse(this.state.widgetUrl); + const eventOrigin = url.parse(event.origin); + if ( + eventOrigin.protocol !== widgetUrlObj.protocol || + eventOrigin.host !== widgetUrlObj.host + ) { return; } diff --git a/src/components/views/globals/CookieBar.js b/src/components/views/globals/CookieBar.js index ad00884dd2..a63a163dd1 100644 --- a/src/components/views/globals/CookieBar.js +++ b/src/components/views/globals/CookieBar.js @@ -54,9 +54,9 @@ export default class CookieBar extends React.Component { Warning
{ this.props.policyUrl ? _t( - "Help improve Riot by sending usage data? " + - "This will use a cookie. " + - "(See our cookie and privacy policies).", + "Please help improve Riot.im by sending anonymous usage data. " + + "This will use a cookie " + + "(please see our Cookie Policy).", {}, { 'UsageDataLink': (sub) => , }, - ) : _t("Help improve Riot by sending usage data? This will use a cookie.") } + ) : _t( + "Please help improve Riot.im by sending anonymous usage data. " + + "This will use a cookie.", + {}, + { + 'UsageDataLink': (sub) => + { sub } + , + }, + ) }
- { _t("Yes please") } + { _t("Yes, I want to help!") } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 41f1780425..9bab21dec5 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -636,9 +636,9 @@ "Something went wrong when trying to get your communities.": "Something went wrong when trying to get your communities.", "Display your community flair in rooms configured to show it.": "Display your community flair in rooms configured to show it.", "You're not currently a member of any communities.": "You're not currently a member of any communities.", - "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).": "Help improve Riot by sending usage data? This will use a cookie. (See our cookie and privacy policies).", - "Help improve Riot by sending usage data? This will use a cookie.": "Help improve Riot by sending usage data? This will use a cookie.", - "Yes please": "Yes please", + "Please help improve Riot.im by sending anonymous usage data. This will use a cookie (please see our Cookie Policy).": "Please help improve Riot.im by sending anonymous usage data. This will use a cookie (please see our Cookie Policy).", + "Please help improve Riot.im by sending anonymous usage data. This will use a cookie.": "Please help improve Riot.im by sending anonymous usage data. This will use a cookie.", + "Yes, I want to help!": "Yes, I want to help!", "You are not receiving desktop notifications": "You are not receiving desktop notifications", "Enable them now": "Enable them now", "What's New": "What's New", @@ -949,6 +949,8 @@ "This room is not public. You will not be able to rejoin without an invite.": "This room is not public. You will not be able to rejoin without an invite.", "Are you sure you want to leave the room '%(roomName)s'?": "Are you sure you want to leave the room '%(roomName)s'?", "Failed to leave room": "Failed to leave room", + "Can't leave Server Notices room": "Can't leave Server Notices room", + "This room is used for important messages from the Homeserver, so you cannot leave it.": "This room is used for important messages from the Homeserver, so you cannot leave it.", "Signed Out": "Signed Out", "For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.", "Terms and Conditions": "Terms and Conditions",