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

Commit a059be1

Browse files
author
Weblate
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 24ae804 + 033b110 commit a059be1

File tree

4 files changed

+56
-17
lines changed

4 files changed

+56
-17
lines changed

src/components/structures/MatrixChat.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,20 @@ export default React.createClass({
996996
}, (err) => {
997997
modal.close();
998998
console.error("Failed to leave room " + roomId + " " + err);
999+
let title = _t("Failed to leave room");
1000+
let message = _t("Server may be unavailable, overloaded, or you hit a bug.");
1001+
if (err.errcode == 'M_CANNOT_LEAVE_SERVER_NOTICE_ROOM') {
1002+
title = _t("Can't leave Server Notices room");
1003+
message = _t(
1004+
"This room is used for important messages from the Homeserver, " +
1005+
"so you cannot leave it.",
1006+
);
1007+
} else if (err && err.message) {
1008+
message = err.message;
1009+
}
9991010
Modal.createTrackedDialog('Failed to leave room', '', ErrorDialog, {
1000-
title: _t("Failed to leave room"),
1001-
description: (err && err.message ? err.message :
1002-
_t("Server may be unavailable, overloaded, or you hit a bug.")),
1011+
title: title,
1012+
description: message,
10031013
});
10041014
});
10051015
}

src/components/views/elements/AppTile.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,32 @@ export default class AppTile extends React.Component {
122122

123123
/**
124124
* Returns true if specified url is a scalar URL, typically https://scalar.vector.im/api
125-
* @param {[type]} url URL to check
125+
* @param {[type]} testUrlString URL to check
126126
* @return {Boolean} True if specified URL is a scalar URL
127127
*/
128-
isScalarUrl(url) {
129-
if (!url) {
128+
isScalarUrl(testUrlString) {
129+
if (!testUrlString) {
130130
console.error('Scalar URL check failed. No URL specified');
131131
return false;
132132
}
133133

134+
const testUrl = url.parse(testUrlString);
135+
134136
let scalarUrls = SdkConfig.get().integrations_widgets_urls;
135137
if (!scalarUrls || scalarUrls.length == 0) {
136138
scalarUrls = [SdkConfig.get().integrations_rest_url];
137139
}
138140

139141
for (let i = 0; i < scalarUrls.length; i++) {
140-
if (url.startsWith(scalarUrls[i])) {
141-
return true;
142+
const scalarUrl = url.parse(scalarUrls[i]);
143+
if (testUrl && scalarUrl) {
144+
if (
145+
testUrl.protocol === scalarUrl.protocol &&
146+
testUrl.host === scalarUrl.host &&
147+
testUrl.pathname.startsWith(scalarUrl.pathname)
148+
) {
149+
return true;
150+
}
142151
}
143152
}
144153
return false;
@@ -269,7 +278,12 @@ export default class AppTile extends React.Component {
269278
event.origin = event.originalEvent.origin;
270279
}
271280

272-
if (!this.state.widgetUrl.startsWith(event.origin)) {
281+
const widgetUrlObj = url.parse(this.state.widgetUrl);
282+
const eventOrigin = url.parse(event.origin);
283+
if (
284+
eventOrigin.protocol !== widgetUrlObj.protocol ||
285+
eventOrigin.host !== widgetUrlObj.host
286+
) {
273287
return;
274288
}
275289

src/components/views/globals/CookieBar.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export default class CookieBar extends React.Component {
5454
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="Warning" />
5555
<div className="mx_MatrixToolbar_content">
5656
{ this.props.policyUrl ? _t(
57-
"Help improve Riot by sending <UsageDataLink>usage data</UsageDataLink>? " +
58-
"This will use a cookie. " +
59-
"(See our <PolicyLink>cookie and privacy policies</PolicyLink>).",
57+
"Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. " +
58+
"This will use a cookie " +
59+
"(please see our <PolicyLink>Cookie Policy</PolicyLink>).",
6060
{},
6161
{
6262
'UsageDataLink': (sub) => <a
@@ -76,10 +76,23 @@ export default class CookieBar extends React.Component {
7676
</a>
7777
,
7878
},
79-
) : _t("Help improve Riot by sending usage data? This will use a cookie.") }
79+
) : _t(
80+
"Please help improve Riot.im by sending <UsageDataLink>anonymous usage data</UsageDataLink>. " +
81+
"This will use a cookie.",
82+
{},
83+
{
84+
'UsageDataLink': (sub) => <a
85+
className="mx_MatrixToolbar_link"
86+
href="javascript:;"
87+
onClick={this.onUsageDataClicked}
88+
>
89+
{ sub }
90+
</a>,
91+
},
92+
) }
8093
</div>
8194
<AccessibleButton element='button' className="mx_MatrixToolbar_action" onClick={this.onAccept}>
82-
{ _t("Yes please") }
95+
{ _t("Yes, I want to help!") }
8396
</AccessibleButton>
8497
<AccessibleButton className="mx_MatrixToolbar_close" onClick={this.onReject}>
8598
<img src="img/cancel.svg" width="18" height="18" />

src/i18n/strings/en_EN.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,9 @@
636636
"Something went wrong when trying to get your communities.": "Something went wrong when trying to get your communities.",
637637
"Display your community flair in rooms configured to show it.": "Display your community flair in rooms configured to show it.",
638638
"You're not currently a member of any communities.": "You're not currently a member of any communities.",
639-
"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>).",
640-
"Help improve Riot by sending usage data? This will use a cookie.": "Help improve Riot by sending usage data? This will use a cookie.",
641-
"Yes please": "Yes please",
639+
"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>).",
640+
"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.",
641+
"Yes, I want to help!": "Yes, I want to help!",
642642
"You are not receiving desktop notifications": "You are not receiving desktop notifications",
643643
"Enable them now": "Enable them now",
644644
"What's New": "What's New",
@@ -949,6 +949,8 @@
949949
"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.",
950950
"Are you sure you want to leave the room '%(roomName)s'?": "Are you sure you want to leave the room '%(roomName)s'?",
951951
"Failed to leave room": "Failed to leave room",
952+
"Can't leave Server Notices room": "Can't leave Server Notices room",
953+
"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.",
952954
"Signed Out": "Signed Out",
953955
"For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.",
954956
"Terms and Conditions": "Terms and Conditions",

0 commit comments

Comments
 (0)