Skip to content

Commit 746647d

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 9275b31 + 0fbd73a commit 746647d

30 files changed

Lines changed: 194 additions & 114 deletions

‎electron_app/package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"description": "A feature-rich client for Matrix.org",
77
"author": "Vector Creations Ltd.",
88
"dependencies": {
9+
"electron-window-state": "^4.1.0",
910
"auto-launch": "^5.0.1",
10-
"electron-window-state": "^4.1.0"
11+
"minimist": "^1.2.0"
1112
}
1213
}

‎electron_app/src/electron-main.js‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ limitations under the License.
2121
const checkSquirrelHooks = require('./squirrelhooks');
2222
if (checkSquirrelHooks()) return;
2323

24+
const argv = require('minimist')(process.argv);
2425
const electron = require('electron');
2526
const AutoLaunch = require('auto-launch');
2627

@@ -30,6 +31,10 @@ const webContentsHandler = require('./webcontents-handler');
3031

3132
const windowStateKeeper = require('electron-window-state');
3233

34+
if (argv.profile) {
35+
electron.app.setPath('userData', `${electron.app.getPath('userData')}-${argv.profile}`);
36+
}
37+
3338
let vectorConfig = {};
3439
try {
3540
vectorConfig = require('../../webapp/config.json');
@@ -119,19 +124,19 @@ electron.ipcMain.on('install_update', installUpdate);
119124
let focusHandlerAttached = false;
120125
electron.ipcMain.on('setBadgeCount', function(ev, count) {
121126
electron.app.setBadgeCount(count);
122-
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused()) {
123-
if (count > 0) {
124-
if (!focusHandlerAttached) {
125-
mainWindow.once('focus', () => {
126-
mainWindow.flashFrame(false);
127-
focusHandlerAttached = false;
128-
});
129-
focusHandlerAttached = true;
130-
}
131-
mainWindow.flashFrame(true);
132-
} else {
127+
if (count === 0) {
128+
mainWindow.flashFrame(false);
129+
}
130+
});
131+
132+
electron.ipcMain.on('loudNotification', function() {
133+
if (process.platform === 'win32' && mainWindow && !mainWindow.isFocused() && !focusHandlerAttached) {
134+
mainWindow.flashFrame(true);
135+
mainWindow.once('focus', () => {
133136
mainWindow.flashFrame(false);
134-
}
137+
focusHandlerAttached = false;
138+
});
139+
focusHandlerAttached = true;
135140
}
136141
});
137142

@@ -166,7 +171,7 @@ const shouldQuit = electron.app.makeSingleInstance((commandLine, workingDirector
166171

167172
if (shouldQuit) {
168173
console.log('Other instance detected: exiting');
169-
electron.app.quit();
174+
electron.app.exit();
170175
}
171176

172177

@@ -249,7 +254,7 @@ electron.app.on('ready', () => {
249254
brand: vectorConfig.brand || 'Riot',
250255
});
251256

252-
if (!process.argv.includes('--hidden')) {
257+
if (!argv.hidden) {
253258
mainWindow.once('ready-to-show', () => {
254259
mainWindow.show();
255260
});

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"gfm.css": "^1.1.1",
6666
"highlight.js": "^9.0.0",
6767
"linkifyjs": "^2.1.3",
68-
"matrix-js-sdk": "matrix-org/matrix-js-sdk#develop",
69-
"matrix-react-sdk": "matrix-org/matrix-react-sdk#develop",
68+
"matrix-js-sdk": "0.7.9",
69+
"matrix-react-sdk": "0.9.0-rc.1",
7070
"modernizr": "^3.1.0",
7171
"pako": "^1.0.5",
7272
"q": "^1.4.1",

‎scripts/fetch-develop.deps.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ dodep matrix-org matrix-react-sdk
4242
mkdir -p node_modules
4343
cd node_modules
4444

45-
rm -r matrix-js-sdk 2> /dev/null
45+
rm -r matrix-js-sdk 2> /dev/null || true
4646
ln -s ../matrix-js-sdk ./
4747
pushd matrix-js-sdk
4848
npm install
4949
popd
5050

51-
rm -r matrix-react-sdk 2> /dev/null
51+
rm -r matrix-react-sdk 2> /dev/null || true
5252
ln -s ../matrix-react-sdk ./
5353
pushd matrix-react-sdk
5454
mkdir -p node_modules

‎src/components/views/context_menus/MessageContextMenu.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ module.exports = React.createClass({
182182
if (content.msgtype && content.msgtype !== 'm.bad.encrypted' && content.hasOwnProperty('body')) {
183183
forwardButton = (
184184
<div className="mx_MessageContextMenu_field" onClick={this.onForwardClick}>
185-
Forward Message
185+
{ _t('Forward Message') }
186186
</div>
187187
);
188188
}

‎src/components/views/dialogs/BugReportDialog.js‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
import React from 'react';
1818
import sdk from 'matrix-react-sdk';
1919
import SdkConfig from 'matrix-react-sdk/lib/SdkConfig';
20+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2021

2122
export default class BugReportDialog extends React.Component {
2223
constructor(props, context) {
@@ -49,12 +50,12 @@ export default class BugReportDialog extends React.Component {
4950
const userText = this.state.text;
5051
if (!sendLogs && userText.trim().length === 0) {
5152
this.setState({
52-
err: "Please describe the bug and/or send logs.",
53+
err: _t("Please describe the bug and/or send logs."),
5354
});
5455
return;
5556
}
5657
this.setState({ busy: true, progress: null, err: null });
57-
this._sendProgressCallback("Loading bug report module");
58+
this._sendProgressCallback(_t("Loading bug report module"));
5859

5960
require(['../../../vector/submit-rageshake'], (s) => {
6061
s(SdkConfig.get().bug_report_endpoint_url, {
@@ -69,8 +70,9 @@ export default class BugReportDialog extends React.Component {
6970
}, (err) => {
7071
if (!this._unmounted) {
7172
this.setState({
72-
busy: false, progress: null,
73-
err: `Failed to send report: ${err.message}`,
73+
busy: false,
74+
progress: null,
75+
err: _t("Failed to send report: ") + `${err.message}`,
7476
});
7577
}
7678
});
@@ -105,7 +107,7 @@ export default class BugReportDialog extends React.Component {
105107
let cancelButton = null;
106108
if (!this.state.busy) {
107109
cancelButton = <button onClick={this._onCancel}>
108-
Cancel
110+
{ _t("Cancel") }
109111
</button>;
110112
}
111113

@@ -122,25 +124,27 @@ export default class BugReportDialog extends React.Component {
122124
return (
123125
<div className="mx_BugReportDialog">
124126
<div className="mx_Dialog_title">
125-
Report a bug
127+
{ _t("Report a bug") }
126128
</div>
127129
<div className="mx_Dialog_content">
128-
<p>Please describe the bug. What did you do?
129-
What did you expect to happen?
130-
What actually happened?</p>
130+
<p>
131+
{ _t("Please describe the bug. What did you do? What did you expect to happen? What actually happened?") }
132+
</p>
131133
<textarea
132134
className="mx_BugReportDialog_input"
133135
rows={5}
134136
onChange={this._onTextChange}
135137
value={this.state.text}
136-
placeholder="Describe your problem here."
138+
placeholder={_t("Describe your problem here.")}
137139
/>
138-
<p>In order to diagnose problems, logs from this client will be sent with
139-
this bug report.
140-
If you would prefer to only send the text above, please untick:</p>
140+
<p>
141+
{ _t("In order to diagnose problems, logs from this client will be sent with this bug report. If you would prefer to only send the text above, please untick:") }
142+
</p>
141143
<input type="checkbox" checked={this.state.sendLogs}
142144
onChange={this._onSendLogsChange} id="mx_BugReportDialog_logs"/>
143-
<label htmlFor="mx_BugReportDialog_logs">Send logs</label>
145+
<label htmlFor="mx_BugReportDialog_logs">
146+
{ _t("Send logs") }
147+
</label>
144148
{progress}
145149
{error}
146150
</div>
@@ -151,7 +155,7 @@ export default class BugReportDialog extends React.Component {
151155
autoFocus={true}
152156
disabled={this.state.busy}
153157
>
154-
Send
158+
{ _t("Send") }
155159
</button>
156160

157161
{cancelButton}

‎src/components/views/dialogs/ChangelogDialog.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import React from 'react';
1818
import sdk from 'matrix-react-sdk';
1919
import request from 'browser-request';
20+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2021

2122
const REPOS = ['vector-im/vector-web', 'matrix-org/matrix-react-sdk', 'matrix-org/matrix-js-sdk'];
2223

@@ -70,16 +71,16 @@ export default class ChangelogDialog extends React.Component {
7071

7172
const content = (
7273
<div className="mx_ChangelogDialog_content">
73-
{this.props.version == null || this.props.newVersion == null ? <h2>Unavailable</h2> : logs}
74+
{this.props.version == null || this.props.newVersion == null ? <h2>{_t("Unavailable")}</h2> : logs}
7475
</div>
7576
);
7677

7778

7879
return (
7980
<QuestionDialog
80-
title="Changelog"
81+
title={_t("Changelog")}
8182
description={content}
82-
button="Update"
83+
button={_t("Update")}
8384
onFinished={this.props.onFinished}
8485
/>
8586
)

‎src/components/views/globals/GuestWarningBar.js‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ limitations under the License.
1515
*/
1616

1717
var React = require('react');
18-
var dis = require('matrix-react-sdk/lib/dispatcher')
18+
var dis = require('matrix-react-sdk/lib/dispatcher');
19+
import { _tJsx } from 'matrix-react-sdk/lib/languageHandler';
1920

2021
module.exports = React.createClass({
2122
displayName: 'GuestWarningBar',
@@ -34,7 +35,17 @@ module.exports = React.createClass({
3435
<div className="mx_GuestWarningBar">
3536
<img className="mx_GuestWarningBar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
3637
<div>
37-
You are Rioting as a guest. <a onClick={this.onRegisterClicked}>Register</a> or <a onClick={this.onLoginClicked}>sign in</a> to access more rooms and features.
38+
{ _tJsx(
39+
"You are Rioting as a guest. <a>Register</a> or <a>sign in</a> to access more rooms and features!",
40+
[
41+
/<a>(.*?)<\/a>/,
42+
/<a>(.*?)<\/a>/
43+
],
44+
[
45+
(sub) => <a onClick={this.onRegisterClicked}>{sub}</a>,
46+
(sub) => <a onClick={this.onLoginClicked}>{sub}</a>
47+
]
48+
) }
3849
</div>
3950
</div>
4051
);

‎src/components/views/globals/NewVersionBar.js‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import React from 'react';
2020
import sdk from 'matrix-react-sdk';
2121
import Modal from 'matrix-react-sdk/lib/Modal';
2222
import PlatformPeg from 'matrix-react-sdk/lib/PlatformPeg';
23+
import { _t } from 'matrix-react-sdk/lib/languageHandler';
2324

2425
/**
2526
* Check a version string is compatible with the Changelog
@@ -40,9 +41,9 @@ export default React.createClass({
4041
displayReleaseNotes: function(releaseNotes) {
4142
const QuestionDialog = sdk.getComponent('dialogs.QuestionDialog');
4243
Modal.createDialog(QuestionDialog, {
43-
title: "What's New",
44+
title: _t("What's New"),
4445
description: <pre className="changelog_text">{releaseNotes}</pre>,
45-
button: "Update",
46+
button: _t("Update"),
4647
onFinished: (update) => {
4748
if(update && PlatformPeg.get()) {
4849
PlatformPeg.get().installUpdate();
@@ -75,17 +76,29 @@ export default React.createClass({
7576
// automatically tells you what's changed (provided the versions
7677
// are in the right format)
7778
if (this.props.releaseNotes) {
78-
action_button = <button className="mx_MatrixToolbar_action" onClick={this.displayReleaseNotes}>What's new?</button>;
79+
action_button = (
80+
<button className="mx_MatrixToolbar_action" onClick={this.displayReleaseNotes}>
81+
{ _t("What's new?") }
82+
</button>
83+
);
7984
} else if (checkVersion(this.props.version) && checkVersion(this.props.newVersion)) {
80-
action_button = <button className="mx_MatrixToolbar_action" onClick={this.displayChangelog}>What's new?</button>;
85+
action_button = (
86+
<button className="mx_MatrixToolbar_action" onClick={this.displayChangelog}>
87+
{ _t("What's new?") }
88+
</button>
89+
);
8190
} else if (PlatformPeg.get()) {
82-
action_button = <button className="mx_MatrixToolbar_action" onClick={this.onUpdateClicked}>Update</button>;
91+
action_button = (
92+
<button className="mx_MatrixToolbar_action" onClick={this.onUpdateClicked}>
93+
{ _t("Update") }
94+
</button>
95+
);
8396
}
8497
return (
8598
<div className="mx_MatrixToolbar">
8699
<img className="mx_MatrixToolbar_warning" src="img/warning.svg" width="24" height="23" alt="/!\"/>
87100
<div className="mx_MatrixToolbar_content">
88-
A new version of Riot is available.
101+
{_t("A new version of Riot is available.")}
89102
</div>
90103
{action_button}
91104
</div>

‎src/components/views/login/VectorCustomServerDialog.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
var React = require("react");
18+
var sanitizeHtml = require("sanitize-html");
1819
import { _t } from 'matrix-react-sdk/lib/languageHandler';
1920

2021
module.exports = React.createClass({
@@ -30,7 +31,7 @@ module.exports = React.createClass({
3031
{ _t('Custom Server Options') }
3132
</div>
3233
<div className="mx_Dialog_content">
33-
<span dangerouslySetInnerHTML={{__html: _t('customServer_text')}} />
34+
<span dangerouslySetInnerHTML={{__html: sanitizeHtml(_t('customServer_text'))}} />
3435
</div>
3536
<div className="mx_Dialog_buttons">
3637
<button onClick={this.props.onFinished} autoFocus={true}>

0 commit comments

Comments
 (0)