diff options
Diffstat (limited to 'webapp/components/user_settings')
8 files changed, 144 insertions, 28 deletions
diff --git a/webapp/components/user_settings/custom_theme_chooser.jsx b/webapp/components/user_settings/custom_theme_chooser.jsx index 9fbdd1251..e77ea1d30 100644 --- a/webapp/components/user_settings/custom_theme_chooser.jsx +++ b/webapp/components/user_settings/custom_theme_chooser.jsx @@ -230,11 +230,11 @@ class CustomThemeChooser extends React.Component { overlay={popoverContent} ref='headerOverlay' > - <span className='input-group-addon'> - <img - src={codeThemeURL} - /> - </span> + <span className='input-group-addon'> + <img + src={codeThemeURL} + /> + </span> </OverlayTrigger> </div> </div> diff --git a/webapp/components/user_settings/import_theme_modal.jsx b/webapp/components/user_settings/import_theme_modal.jsx index 32da296bf..f743feee6 100644 --- a/webapp/components/user_settings/import_theme_modal.jsx +++ b/webapp/components/user_settings/import_theme_modal.jsx @@ -81,7 +81,7 @@ class ImportThemeModal extends React.Component { theme.mentionHighlightLink = '#2f81b7'; theme.codeTheme = 'github'; - let user = UserStore.getCurrentUser(); + const user = UserStore.getCurrentUser(); user.theme_props = theme; Client.updateUser(user, diff --git a/webapp/components/user_settings/premade_theme_chooser.jsx b/webapp/components/user_settings/premade_theme_chooser.jsx index 4b0faf865..9552c686d 100644 --- a/webapp/components/user_settings/premade_theme_chooser.jsx +++ b/webapp/components/user_settings/premade_theme_chooser.jsx @@ -59,6 +59,7 @@ export default class PremadeThemeChooser extends React.Component { <a href='http://docs.mattermost.com/help/settings/theme-colors.html#custom-theme-examples' target='_blank' + rel='noopener noreferrer' > <FormattedMessage id='user.settings.display.theme.otherThemes' diff --git a/webapp/components/user_settings/user_settings_display.jsx b/webapp/components/user_settings/user_settings_display.jsx index c4af57d4c..fa0118d1e 100644 --- a/webapp/components/user_settings/user_settings_display.jsx +++ b/webapp/components/user_settings/user_settings_display.jsx @@ -23,7 +23,8 @@ function getDisplayStateFromStores() { militaryTime: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time', 'false'), nameFormat: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'name_format', 'username'), selectedFont: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, 'selected_font', Constants.DEFAULT_FONT), - channelDisplayMode: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) + channelDisplayMode: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT), + messageDisplay: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.MESSAGE_DISPLAY, Preferences.MESSAGE_DISPLAY_DEFAULT) }; } @@ -70,8 +71,14 @@ export default class UserSettingsDisplay extends React.Component { name: Preferences.CHANNEL_DISPLAY_MODE, value: this.state.channelDisplayMode }; + const messageDisplayPreference = { + user_id: userId, + category: Preferences.CATEGORY_DISPLAY_SETTINGS, + name: Preferences.MESSAGE_DISPLAY, + value: this.state.messageDisplay + }; - AsyncClient.savePreferences([timePreference, namePreference, fontPreference, channelDisplayModePreference], + AsyncClient.savePreferences([timePreference, namePreference, fontPreference, channelDisplayModePreference, messageDisplayPreference], () => { this.updateSection(''); }, @@ -89,6 +96,9 @@ export default class UserSettingsDisplay extends React.Component { handleChannelDisplayModeRadio(channelDisplayMode) { this.setState({channelDisplayMode}); } + handlemessageDisplayRadio(messageDisplay) { + this.setState({messageDisplay}); + } handleFont(selectedFont) { Utils.applyFont(selectedFont); this.setState({selectedFont}); @@ -115,6 +125,7 @@ export default class UserSettingsDisplay extends React.Component { let channelDisplayModeSection; let fontSection; let languagesSection; + let messageDisplaySection; if (this.props.activeSection === 'clock') { const clockFormat = [false, false]; @@ -350,6 +361,105 @@ export default class UserSettingsDisplay extends React.Component { ); } + if (this.props.activeSection === Preferences.MESSAGE_DISPLAY) { + const messageDisplay = [false, false]; + if (this.state.messageDisplay === Preferences.MESSAGE_DISPLAY_CLEAN) { + messageDisplay[0] = true; + } else { + messageDisplay[1] = true; + } + + const inputs = [ + <div key='userDisplayNameOptions'> + <div className='radio'> + <label> + <input + type='radio' + checked={messageDisplay[0]} + onChange={this.handlemessageDisplayRadio.bind(this, Preferences.MESSAGE_DISPLAY_CLEAN)} + /> + <FormattedMessage + id='user.settings.display.messageDisplayClean' + defaultMessage='Clean' + /> + </label> + <br/> + </div> + <div className='radio'> + <label> + <input + type='radio' + checked={messageDisplay[1]} + onChange={this.handlemessageDisplayRadio.bind(this, Preferences.MESSAGE_DISPLAY_COMPACT)} + /> + <FormattedMessage + id='user.settings.display.messageDisplayCompact' + defaultMessage='Compact' + /> + </label> + <br/> + </div> + <div> + <br/> + <FormattedMessage + id='user.settings.display.messageDisplayDescription' + defaultMessage='Select how messages in a channel should be displayed.' + /> + </div> + </div> + ]; + + messageDisplaySection = ( + <SettingItemMax + title={ + <FormattedMessage + id='user.settings.display.messageDisplayTitle' + defaultMessage='Message Display' + /> + } + inputs={inputs} + submit={this.handleSubmit} + server_error={serverError} + updateSection={(e) => { + this.updateSection(''); + e.preventDefault(); + }} + /> + ); + } else { + let describe; + if (this.state.messageDisplay === Preferences.MESSAGE_DISPLAY_CLEAN) { + describe = ( + <FormattedMessage + id='user.settings.display.messageDisplayClean' + defaultMessage='Clean' + /> + ); + } else { + describe = ( + <FormattedMessage + id='user.settings.display.messageDisplayCompact' + defaultMessage='Compact' + /> + ); + } + + messageDisplaySection = ( + <SettingItemMin + title={ + <FormattedMessage + id='user.settings.display.messageDisplayTitle' + defaultMessage='Message Display' + /> + } + describe={describe} + updateSection={() => { + this.props.updateSection(Preferences.MESSAGE_DISPLAY); + }} + /> + ); + } + if (this.props.activeSection === Preferences.CHANNEL_DISPLAY_MODE) { const channelDisplayMode = [false, false]; if (this.state.channelDisplayMode === Preferences.CHANNEL_DISPLAY_MODE_CENTERED) { @@ -392,7 +502,7 @@ export default class UserSettingsDisplay extends React.Component { <br/> <FormattedMessage id='user.settings.display.channeldisplaymode' - defaultMessage='Select how text in a channel is displayed.' + defaultMessage='Select the width of the center channel.' /> </div> </div> @@ -601,6 +711,8 @@ export default class UserSettingsDisplay extends React.Component { <div className='divider-dark'/> {nameFormatSection} <div className='divider-dark'/> + {messageDisplaySection} + <div className='divider-dark'/> {channelDisplayModeSection} <div className='divider-dark'/> {languagesSection} diff --git a/webapp/components/user_settings/user_settings_general.jsx b/webapp/components/user_settings/user_settings_general.jsx index be1d1e6c5..8e4954e5a 100644 --- a/webapp/components/user_settings/user_settings_general.jsx +++ b/webapp/components/user_settings/user_settings_general.jsx @@ -160,6 +160,11 @@ class UserSettingsGeneralTab extends React.Component { const email = this.state.email.trim().toLowerCase(); const confirmEmail = this.state.confirmEmail.trim().toLowerCase(); + if (user.email === email) { + this.updateSection(''); + return; + } + const {formatMessage} = this.props.intl; if (email === '' || !Utils.isEmail(email)) { this.setState({emailError: formatMessage(holders.validEmail), clientError: '', serverError: ''}); @@ -171,11 +176,6 @@ class UserSettingsGeneralTab extends React.Component { return; } - if (user.email === email) { - this.updateSection(''); - return; - } - user.email = email; this.submitUser(user, true); } diff --git a/webapp/components/user_settings/user_settings_notifications.jsx b/webapp/components/user_settings/user_settings_notifications.jsx index fa84ce2d6..6a3f598e2 100644 --- a/webapp/components/user_settings/user_settings_notifications.jsx +++ b/webapp/components/user_settings/user_settings_notifications.jsx @@ -150,13 +150,13 @@ class NotificationsTab extends React.Component { data.channel = this.state.channelKey.toString(); Client.updateUserNotifyProps(data, - function success() { + () => { this.props.updateSection(''); AsyncClient.getMe(); - }.bind(this), - function failure(err) { + }, + (err) => { this.setState({serverError: err.message}); - }.bind(this) + } ); } handleCancel(e) { @@ -254,7 +254,8 @@ class NotificationsTab extends React.Component { <div key='userNotificationLevelOption'> <div className='radio'> <label> - <input type='radio' + <input + type='radio' checked={notifyActive[0]} onChange={this.handleNotifyRadio.bind(this, 'all')} /> @@ -393,8 +394,8 @@ class NotificationsTab extends React.Component { /> </label> <br/> - </div> - </div> + </div> + </div> ); const extraInfo = ( diff --git a/webapp/components/user_settings/user_settings_security.jsx b/webapp/components/user_settings/user_settings_security.jsx index 700aa295a..433d08d5c 100644 --- a/webapp/components/user_settings/user_settings_security.jsx +++ b/webapp/components/user_settings/user_settings_security.jsx @@ -608,11 +608,11 @@ class SecurityTab extends React.Component { const inputs = []; inputs.push( <div key='userSignInOption'> - {emailOption} - {gitlabOption} - <br/> - {ldapOption} - {googleOption} + {emailOption} + {gitlabOption} + <br/> + {ldapOption} + {googleOption} </div> ); diff --git a/webapp/components/user_settings/user_settings_theme.jsx b/webapp/components/user_settings/user_settings_theme.jsx index f19538f71..389fde004 100644 --- a/webapp/components/user_settings/user_settings_theme.jsx +++ b/webapp/components/user_settings/user_settings_theme.jsx @@ -212,7 +212,8 @@ export default class ThemeSetting extends React.Component { key='premadeThemeColorLabel' > <label> - <input type='radio' + <input + type='radio' checked={!displayCustom} onChange={this.updateType.bind(this, 'premade')} /> @@ -233,7 +234,8 @@ export default class ThemeSetting extends React.Component { key='customThemeColorLabel' > <label> - <input type='radio' + <input + type='radio' checked={displayCustom} onChange={this.updateType.bind(this, 'custom')} /> |