Fix more react warnings & fix saving theme (#4667)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
02d581c159
Коммит
702c4cb121
@@ -236,7 +236,7 @@ function onThemeSaved(teamId, theme, onSuccess) {
|
|||||||
const toDelete = [];
|
const toDelete = [];
|
||||||
|
|
||||||
for (const [name] of themePreferences) {
|
for (const [name] of themePreferences) {
|
||||||
if (name === '') {
|
if (name === '' || name === teamId) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,6 +247,7 @@ function onThemeSaved(teamId, theme, onSuccess) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toDelete.length > 0) {
|
||||||
// we're saving a new global theme so delete any team-specific ones
|
// we're saving a new global theme so delete any team-specific ones
|
||||||
AsyncClient.deletePreferences(toDelete);
|
AsyncClient.deletePreferences(toDelete);
|
||||||
|
|
||||||
@@ -255,6 +256,7 @@ function onThemeSaved(teamId, theme, onSuccess) {
|
|||||||
type: ActionTypes.DELETED_PREFERENCES,
|
type: ActionTypes.DELETED_PREFERENCES,
|
||||||
preferences: toDelete
|
preferences: toDelete
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
onSuccess();
|
onSuccess();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ export default class FileAttachmentList extends React.Component {
|
|||||||
} else if (this.props.fileCount > 0) {
|
} else if (this.props.fileCount > 0) {
|
||||||
for (let i = 0; i < Math.min(this.props.fileCount, Constants.MAX_DISPLAY_FILES); i++) {
|
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
|
// 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 = {
|
FileAttachmentList.propTypes = {
|
||||||
fileCount: React.PropTypes.number.isRequired,
|
fileCount: React.PropTypes.number.isRequired,
|
||||||
fileInfos: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
|
fileInfos: React.PropTypes.arrayOf(React.PropTypes.object),
|
||||||
compactDisplay: React.PropTypes.bool
|
compactDisplay: React.PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default class EmailNotificationSetting extends React.Component {
|
|||||||
enableEmail: React.PropTypes.bool.isRequired,
|
enableEmail: React.PropTypes.bool.isRequired,
|
||||||
onChange: React.PropTypes.func.isRequired,
|
onChange: React.PropTypes.func.isRequired,
|
||||||
onSubmit: React.PropTypes.func.isRequired,
|
onSubmit: React.PropTypes.func.isRequired,
|
||||||
serverError: React.PropTypes.string.isRequired
|
serverError: React.PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
defaultMessage='Enable Post Formatting'
|
defaultMessage='Enable Post Formatting'
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
inputs={
|
inputs={[
|
||||||
<div>
|
<div key='formattingSetting'>
|
||||||
<div className='radio'>
|
<div className='radio'>
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
@@ -215,7 +215,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
]}
|
||||||
submit={() => this.handleSubmit('formatting')}
|
submit={() => this.handleSubmit('formatting')}
|
||||||
server_error={this.state.serverError}
|
server_error={this.state.serverError}
|
||||||
updateSection={(e) => {
|
updateSection={(e) => {
|
||||||
@@ -251,8 +251,8 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
defaultMessage='Enable Join/Leave Messages'
|
defaultMessage='Enable Join/Leave Messages'
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
inputs={
|
inputs={[
|
||||||
<div>
|
<div key='joinLeaveSetting'>
|
||||||
<div className='radio'>
|
<div className='radio'>
|
||||||
<label>
|
<label>
|
||||||
<input
|
<input
|
||||||
@@ -291,7 +291,7 @@ export default class AdvancedSettingsDisplay extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
]}
|
||||||
submit={() => this.handleSubmit('join_leave')}
|
submit={() => this.handleSubmit('join_leave')}
|
||||||
server_error={this.state.serverError}
|
server_error={this.state.serverError}
|
||||||
updateSection={(e) => {
|
updateSection={(e) => {
|
||||||
|
|||||||
@@ -885,7 +885,7 @@ export default class NotificationsTab extends React.Component {
|
|||||||
<EmailNotificationSetting
|
<EmailNotificationSetting
|
||||||
activeSection={this.props.activeSection}
|
activeSection={this.props.activeSection}
|
||||||
updateSection={this.props.updateSection}
|
updateSection={this.props.updateSection}
|
||||||
enableEmail={this.state.enableEmail}
|
enableEmail={this.state.enableEmail === 'true'}
|
||||||
onChange={this.handleEmailRadio}
|
onChange={this.handleEmailRadio}
|
||||||
onSubmit={this.handleSubmit}
|
onSubmit={this.handleSubmit}
|
||||||
serverError={this.state.serverError}
|
serverError={this.state.serverError}
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ export default class ThemeSetting extends React.Component {
|
|||||||
inputs.push(custom);
|
inputs.push(custom);
|
||||||
|
|
||||||
inputs.push(
|
inputs.push(
|
||||||
<div>
|
<div key='otherThemes'>
|
||||||
<br/>
|
<br/>
|
||||||
<a
|
<a
|
||||||
href='http://docs.mattermost.com/help/settings/theme-colors.html#custom-theme-examples'
|
href='http://docs.mattermost.com/help/settings/theme-colors.html#custom-theme-examples'
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user