From 20bdae6079e16d07a498e373d40e31ddc95c118b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 8 Jun 2017 18:35:45 +0100 Subject: [PATCH 1/2] delint UserSettings.js --- .eslintignore.errorfiles | 1 - src/components/structures/UserSettings.js | 153 ++++++++++++++-------- 2 files changed, 95 insertions(+), 59 deletions(-) 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
@@ -639,7 +645,7 @@ module.exports = React.createClass({ UserSettingsStore.setUrlPreviewsDisabled(e.target.checked) } + onChange={ this._onPreviewsDisabledChanged } />
; }, + _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 } />