diff --git a/.eslintignore.errorfiles b/.eslintignore.errorfiles
index f1b63d7367..20c4ca3b4a 100644
--- a/.eslintignore.errorfiles
+++ b/.eslintignore.errorfiles
@@ -30,7 +30,6 @@ src/components/structures/RoomView.js
src/components/structures/ScrollPanel.js
src/components/structures/TimelinePanel.js
src/components/structures/UploadBar.js
-src/components/structures/UserSettings.js
src/components/views/avatars/BaseAvatar.js
src/components/views/avatars/MemberAvatar.js
src/components/views/avatars/RoomAvatar.js
diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js
index 9059378d32..e87bde6d87 100644
--- a/src/components/structures/UserSettings.js
+++ b/src/components/structures/UserSettings.js
@@ -389,7 +389,10 @@ module.exports = React.createClass({
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: _t("Success"),
- description: _t("Your password was successfully changed. You will not receive push notifications on other devices until you log back in to them") + ".",
+ description: _t(
+ "Your password was successfully changed. You will not receive " +
+ "push notifications on other devices until you log back in to them",
+ ) + ".",
});
dis.dispatch({action: 'password_changed'});
},
@@ -427,7 +430,10 @@ module.exports = React.createClass({
this._addThreepid.addEmailAddress(emailAddress, true).done(() => {
Modal.createDialog(QuestionDialog, {
title: _t("Verification Pending"),
- description: _t("Please check your email and click on the link it contains. Once this is done, click continue."),
+ description: _t(
+ "Please check your email and click on the link it contains. Once this " +
+ "is done, click continue.",
+ ),
button: _t('Continue'),
onFinished: this.onEmailDialogFinished,
});
@@ -447,7 +453,7 @@ module.exports = React.createClass({
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: _t("Remove Contact Information?"),
- description: _t("Remove %(threePid)s?", { threePid : threepid.address }),
+ description: _t("Remove %(threePid)s?", { threePid: threepid.address }),
button: _t('Remove'),
onFinished: (submit) => {
if (submit) {
@@ -489,8 +495,8 @@ module.exports = React.createClass({
this.setState({email_add_pending: false});
if (err.errcode == 'M_THREEPID_AUTH_FAILED') {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
- let message = _t("Unable to verify email address.") + " " +
- _t("Please check your email and click on the link it contains. Once this is done, click continue.");
+ const message = _t("Unable to verify email address.") + " " +
+ _t("Please check your email and click on the link it contains. Once this is done, click continue.");
Modal.createDialog(QuestionDialog, {
title: _t("Verification Pending"),
description: message,
@@ -608,7 +614,7 @@ module.exports = React.createClass({
}
},
- _renderLanguageSetting: function () {
+ _renderLanguageSetting: function() {
const LanguageDropdown = sdk.getComponent('views.elements.LanguageDropdown');
return
{_t('Interface Language')}
@@ -639,7 +645,7 @@ module.exports = React.createClass({
UserSettingsStore.setUrlPreviewsDisabled(e.target.checked) }
+ onChange={ this._onPreviewsDisabledChanged }
/>
{ _t("Disable inline URL previews by default") }
@@ -647,17 +653,24 @@ module.exports = React.createClass({
;
},
+ _onPreviewsDisabledChanged: function(e) {
+ UserSettingsStore.setUrlPreviewsDisabled(e.target.checked);
+ },
+
_renderSyncedSetting: function(setting) {
+ // TODO: this ought to be a separate component so that we don't need
+ // to rebind the onChange each time we render
+
+ const onChange = (e) => {
+ UserSettingsStore.setSyncedSetting(setting.id, e.target.checked);
+ if (setting.fn) setting.fn(e.target.checked);
+ };
+
return
{
- UserSettingsStore.setSyncedSetting(setting.id, e.target.checked);
- if (setting.fn) setting.fn(e.target.checked);
- }
- }
+ onChange={ onChange }
/>
{ _t(setting.label) }
@@ -666,22 +679,24 @@ module.exports = React.createClass({
},
_renderThemeSelector: function(setting) {
+ // TODO: this ought to be a separate component so that we don't need
+ // to rebind the onChange each time we render
+ const onChange = (e) => {
+ if (e.target.checked) {
+ UserSettingsStore.setSyncedSetting(setting.id, setting.value);
+ }
+ dis.dispatch({
+ action: 'set_theme',
+ value: setting.value,
+ });
+ };
return
{
- if (e.target.checked) {
- UserSettingsStore.setSyncedSetting(setting.id, setting.value);
- }
- dis.dispatch({
- action: 'set_theme',
- value: setting.value,
- });
- }
- }
+ onChange={ onChange }
/>
{ setting.label }
@@ -720,8 +735,10 @@ module.exports = React.createClass({
{ _t("Cryptography") }
- {_t("Device ID:")} {deviceId}
- {_t("Device key:")} {identityKey}
+ {_t("Device ID:")}
+ {deviceId}
+ {_t("Device key:")}
+ {identityKey}
{ importExportButtons }
@@ -733,16 +750,18 @@ module.exports = React.createClass({
},
_renderLocalSetting: function(setting) {
+ // TODO: this ought to be a separate component so that we don't need
+ // to rebind the onChange each time we render
+ const onChange = (e) => {
+ UserSettingsStore.setLocalSetting(setting.id, e.target.checked);
+ if (setting.fn) setting.fn(e.target.checked);
+ };
+
return
{
- UserSettingsStore.setLocalSetting(setting.id, e.target.checked);
- if (setting.fn) setting.fn(e.target.checked);
- }
- }
+ onChange={ onChange }
/>
{ _t(setting.label) }
@@ -794,26 +813,33 @@ module.exports = React.createClass({
if (this.props.enableLabs === false) return null;
UserSettingsStore.doTranslations();
- const features = UserSettingsStore.LABS_FEATURES.map((feature) => (
-
- {
- if (MatrixClientPeg.get().isGuest()) {
- e.target.checked = false;
- dis.dispatch({action: 'view_set_mxid'});
- return;
- }
+ const features = UserSettingsStore.LABS_FEATURES.map((feature) => {
+ // TODO: this ought to be a separate component so that we don't need
+ // to rebind the onChange each time we render
+ const onChange = (e) => {
+ if (MatrixClientPeg.get().isGuest()) {
+ e.target.checked = false;
+ dis.dispatch({action: 'view_set_mxid'});
+ return;
+ }
- UserSettingsStore.setFeatureEnabled(feature.id, e.target.checked);
- this.forceUpdate();
- }}/>
- {feature.name}
-
- ));
+ UserSettingsStore.setFeatureEnabled(feature.id, e.target.checked);
+ this.forceUpdate();
+ };
+
+ return (
+
+
+ {feature.name}
+
+ );
+ });
return (
{ _t("Labs") }
@@ -865,9 +891,10 @@ module.exports = React.createClass({
if (!this.state.rejectingInvites) {
// bind() the invited rooms so any new invites that may come in as this button is clicked
// don't inadvertently get rejected as well.
+ const onClick = this._onRejectAllInvitesClicked.bind(this, invitedRooms);
reject = (
+ onClick={onClick}>
{_t("Reject all %(invitedRooms)s invites", {invitedRooms: invitedRooms.length})}
);
@@ -885,8 +912,6 @@ module.exports = React.createClass({
const settings = this.state.electron_settings;
if (!settings) return;
- const {ipcRenderer} = require('electron');
-
return
;
},
+ _onAutoLaunchChanged: function(e) {
+ const {ipcRenderer} = require('electron');
+ ipcRenderer.send('settings_set', 'auto-launch', e.target.checked);
+ },
+
_mapWebRtcDevicesToSpans: function(devices) {
return devices.map((device) =>
{device.label} );
},
@@ -1060,6 +1088,9 @@ module.exports = React.createClass({
const threepidsSection = this.state.threepids.map((val, pidIndex) => {
const id = "3pid-" + val.address;
+ // TODO; make a separate component to avoid having to rebind onClick
+ // each time we render
+ const onRemoveClick = (e) => this.onRemoveThreepidClicked(val);
return (
@@ -1071,7 +1102,8 @@ module.exports = React.createClass({
/>
-
+
);
@@ -1222,7 +1254,12 @@ module.exports = React.createClass({
{ _t("Logged in as:") } {this._me}
- {_t('Access Token:')} <{ _t("click to reveal") }>
+ {_t('Access Token:')}
+
+ <{ _t("click to reveal") }>
+
{ _t("Homeserver is") } { MatrixClientPeg.get().getHomeserverUrl() }