diff options
author | enahum <nahumhbl@gmail.com> | 2016-11-29 12:15:46 -0300 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-11-29 10:15:46 -0500 |
commit | 702c4cb12146d4b3d18807d56e013da3aed15836 (patch) | |
tree | 9168eb7ca5e86986c98d90c053c53bdedd0e6f2e | |
parent | 02d581c1599c5d50cc507bd2633f1e3c34b1cc84 (diff) | |
download | chat-702c4cb12146d4b3d18807d56e013da3aed15836.tar.gz chat-702c4cb12146d4b3d18807d56e013da3aed15836.tar.bz2 chat-702c4cb12146d4b3d18807d56e013da3aed15836.zip |
Fix more react warnings & fix saving theme (#4667)
6 files changed, 26 insertions, 19 deletions
diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx index 455ca1730..a93f84e7c 100644 --- a/webapp/actions/user_actions.jsx +++ b/webapp/actions/user_actions.jsx @@ -236,7 +236,7 @@ function onThemeSaved(teamId, theme, onSuccess) { const toDelete = []; for (const [name] of themePreferences) { - if (name === '') { + if (name === '' || name === teamId) { continue; } @@ -247,14 +247,16 @@ function onThemeSaved(teamId, theme, onSuccess) { }); } - // we're saving a new global theme so delete any team-specific ones - AsyncClient.deletePreferences(toDelete); + if (toDelete.length > 0) { + // we're saving a new global theme so delete any team-specific ones + AsyncClient.deletePreferences(toDelete); - // delete them locally before we hear from the server so that the UI flow is smoother - AppDispatcher.handleServerAction({ - type: ActionTypes.DELETED_PREFERENCES, - preferences: toDelete - }); + // delete them locally before we hear from the server so that the UI flow is smoother + AppDispatcher.handleServerAction({ + type: ActionTypes.DELETED_PREFERENCES, + preferences: toDelete + }); + } onSuccess(); } diff --git a/webapp/components/file_attachment_list.jsx b/webapp/components/file_attachment_list.jsx index 3df4684be..3d39d8709 100644 --- a/webapp/components/file_attachment_list.jsx +++ b/webapp/components/file_attachment_list.jsx @@ -39,7 +39,12 @@ export default class FileAttachmentList extends React.Component { } else if (this.props.fileCount > 0) { for (let i = 0; i < Math.min(this.props.fileCount, Constants.MAX_DISPLAY_FILES); i++) { // Add a placeholder to avoid pop-in once we get the file infos for this post - postFiles.push(<div className='post-image__column post-image__column--placeholder'/>); + postFiles.push( + <div + key={`fileCount-${i}`} + className='post-image__column post-image__column--placeholder' + /> + ); } } @@ -61,6 +66,6 @@ export default class FileAttachmentList extends React.Component { FileAttachmentList.propTypes = { fileCount: React.PropTypes.number.isRequired, - fileInfos: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, + fileInfos: React.PropTypes.arrayOf(React.PropTypes.object), compactDisplay: React.PropTypes.bool }; diff --git a/webapp/components/user_settings/email_notification_setting.jsx b/webapp/components/user_settings/email_notification_setting.jsx index e10fd5154..cc81c2faf 100644 --- a/webapp/components/user_settings/email_notification_setting.jsx +++ b/webapp/components/user_settings/email_notification_setting.jsx @@ -24,7 +24,7 @@ export default class EmailNotificationSetting extends React.Component { enableEmail: React.PropTypes.bool.isRequired, onChange: React.PropTypes.func.isRequired, onSubmit: React.PropTypes.func.isRequired, - serverError: React.PropTypes.string.isRequired + serverError: React.PropTypes.string }; constructor(props) { diff --git a/webapp/components/user_settings/user_settings_advanced.jsx b/webapp/components/user_settings/user_settings_advanced.jsx index 4346c952b..70306d871 100644 --- a/webapp/components/user_settings/user_settings_advanced.jsx +++ b/webapp/components/user_settings/user_settings_advanced.jsx @@ -175,8 +175,8 @@ export default class AdvancedSettingsDisplay extends React.Component { defaultMessage='Enable Post Formatting' /> } - inputs={ - <div> + inputs={[ + <div key='formattingSetting'> <div className='radio'> <label> <input @@ -215,7 +215,7 @@ export default class AdvancedSettingsDisplay extends React.Component { /> </div> </div> - } + ]} submit={() => this.handleSubmit('formatting')} server_error={this.state.serverError} updateSection={(e) => { @@ -251,8 +251,8 @@ export default class AdvancedSettingsDisplay extends React.Component { defaultMessage='Enable Join/Leave Messages' /> } - inputs={ - <div> + inputs={[ + <div key='joinLeaveSetting'> <div className='radio'> <label> <input @@ -291,7 +291,7 @@ export default class AdvancedSettingsDisplay extends React.Component { /> </div> </div> - } + ]} submit={() => this.handleSubmit('join_leave')} server_error={this.state.serverError} updateSection={(e) => { diff --git a/webapp/components/user_settings/user_settings_notifications.jsx b/webapp/components/user_settings/user_settings_notifications.jsx index 35df53e0e..da7b9d757 100644 --- a/webapp/components/user_settings/user_settings_notifications.jsx +++ b/webapp/components/user_settings/user_settings_notifications.jsx @@ -885,7 +885,7 @@ export default class NotificationsTab extends React.Component { <EmailNotificationSetting activeSection={this.props.activeSection} updateSection={this.props.updateSection} - enableEmail={this.state.enableEmail} + enableEmail={this.state.enableEmail === 'true'} onChange={this.handleEmailRadio} onSubmit={this.handleSubmit} serverError={this.state.serverError} diff --git a/webapp/components/user_settings/user_settings_theme.jsx b/webapp/components/user_settings/user_settings_theme.jsx index fb3665984..5a286a396 100644 --- a/webapp/components/user_settings/user_settings_theme.jsx +++ b/webapp/components/user_settings/user_settings_theme.jsx @@ -257,7 +257,7 @@ export default class ThemeSetting extends React.Component { inputs.push(custom); inputs.push( - <div> + <div key='otherThemes'> <br/> <a href='http://docs.mattermost.com/help/settings/theme-colors.html#custom-theme-examples' |