Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Weblate 2018-05-24 16:19:11 +00:00
commit a059be1d93
4 changed files with 56 additions and 17 deletions

View file

@ -996,10 +996,20 @@ export default React.createClass({
}, (err) => { }, (err) => {
modal.close(); modal.close();
console.error("Failed to leave room " + roomId + " " + err); 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, { Modal.createTrackedDialog('Failed to leave room', '', ErrorDialog, {
title: _t("Failed to leave room"), title: title,
description: (err && err.message ? err.message : description: message,
_t("Server may be unavailable, overloaded, or you hit a bug.")),
}); });
}); });
} }

View file

@ -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 * 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 * @return {Boolean} True if specified URL is a scalar URL
*/ */
isScalarUrl(url) { isScalarUrl(testUrlString) {
if (!url) { if (!testUrlString) {
console.error('Scalar URL check failed. No URL specified'); console.error('Scalar URL check failed. No URL specified');
return false; return false;
} }
const testUrl = url.parse(testUrlString);
let scalarUrls = SdkConfig.get().integrations_widgets_urls; let scalarUrls = SdkConfig.get().integrations_widgets_urls;
if (!scalarUrls || scalarUrls.length == 0) { if (!scalarUrls || scalarUrls.length == 0) {
scalarUrls = [SdkConfig.get().integrations_rest_url]; scalarUrls = [SdkConfig.get().integrations_rest_url];
} }
for (let i = 0; i < scalarUrls.length; i++) { for (let i = 0; i < scalarUrls.length; i++) {
if (url.startsWith(scalarUrls[i])) { const scalarUrl = url.parse(scalarUrls[i]);
return true; if (testUrl && scalarUrl) {
if (
testUrl.protocol === scalarUrl.protocol &&
testUrl.host === scalarUrl.host &&
testUrl.pathname.startsWith(scalarUrl.pathname)
) {
return true;
}
} }
} }
return false; return false;
@ -269,7 +278,12 @@ export default class AppTile extends React.Component {
event.origin = event.originalEvent.origin; 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; return;
} }

View file

@ -54,9 +54,9 @@ export default class CookieBar extends React.Component {
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="Warning" /> <img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="Warning" />
<div className="mx_MatrixToolbar_content"> <div className="mx_MatrixToolbar_content">
{ this.props.policyUrl ? _t( { this.props.policyUrl ? _t(
"Help improve Riot by sending <UsageDataLink>usage data</UsageDataLink>? " + "Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. " +
"This will use a cookie. " + "This will use a cookie " +
"(See our <PolicyLink>cookie and privacy policies</PolicyLink>).", "(please see our <PolicyLink>Cookie Policy</PolicyLink>).",
{}, {},
{ {
'UsageDataLink': (sub) => <a 'UsageDataLink': (sub) => <a
@ -76,10 +76,23 @@ export default class CookieBar extends React.Component {
</a> </a>
, ,
}, },
) : _t("Help improve Riot by sending usage data? This will use a cookie.") } ) : _t(
"Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. " +
"This will use a cookie.",
{},
{
'UsageDataLink': (sub) => <a
className="mx_MatrixToolbar_link"
href="javascript:;"
onClick={this.onUsageDataClicked}
>
{ sub }
</a>,
},
) }
</div> </div>
<AccessibleButton element='button' className="mx_MatrixToolbar_action" onClick={this.onAccept}> <AccessibleButton element='button' className="mx_MatrixToolbar_action" onClick={this.onAccept}>
{ _t("Yes please") } { _t("Yes, I want to help!") }
</AccessibleButton> </AccessibleButton>
<AccessibleButton className="mx_MatrixToolbar_close" onClick={this.onReject}> <AccessibleButton className="mx_MatrixToolbar_close" onClick={this.onReject}>
<img src="img/cancel.svg" width="18" height="18" /> <img src="img/cancel.svg" width="18" height="18" />

View file

@ -636,9 +636,9 @@
"Something went wrong when trying to get your communities.": "Something went wrong when trying to get your communities.", "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.", "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.", "You're not currently a member of any communities.": "You're not currently a member of any communities.",
"Help improve Riot by sending <UsageDataLink>usage data</UsageDataLink>? This will use a cookie. (See our <PolicyLink>cookie and privacy policies</PolicyLink>).": "Help improve Riot by sending <UsageDataLink>usage data</UsageDataLink>? This will use a cookie. (See our <PolicyLink>cookie and privacy policies</PolicyLink>).", "Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. This will use a cookie (please see our <PolicyLink>Cookie Policy</PolicyLink>).": "Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. This will use a cookie (please see our <PolicyLink>Cookie Policy</PolicyLink>).",
"Help improve Riot by sending usage data? This will use a cookie.": "Help improve Riot by sending usage data? This will use a cookie.", "Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. This will use a cookie.": "Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. This will use a cookie.",
"Yes please": "Yes please", "Yes, I want to help!": "Yes, I want to help!",
"You are not receiving desktop notifications": "You are not receiving desktop notifications", "You are not receiving desktop notifications": "You are not receiving desktop notifications",
"Enable them now": "Enable them now", "Enable them now": "Enable them now",
"What's New": "What's New", "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.", "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'?", "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", "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", "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.", "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", "Terms and Conditions": "Terms and Conditions",