Этот коммит содержится в:
Nick Frazier
2016-12-22 15:30:37 -05:00
коммит произвёл Joram Wilander
родитель bd67c1f227
Коммит 03e1d0aac3

Просмотреть файл

@@ -61,6 +61,7 @@ export default class CreatePost extends React.Component {
this.showPostDeletedModal = this.showPostDeletedModal.bind(this); this.showPostDeletedModal = this.showPostDeletedModal.bind(this);
this.hidePostDeletedModal = this.hidePostDeletedModal.bind(this); this.hidePostDeletedModal = this.hidePostDeletedModal.bind(this);
this.showShortcuts = this.showShortcuts.bind(this); this.showShortcuts = this.showShortcuts.bind(this);
this.checkMessageLength = this.checkMessageLength.bind(this);
PostStore.clearDraftUploads(); PostStore.clearDraftUploads();
@@ -99,7 +100,7 @@ export default class CreatePost extends React.Component {
this.setState({errorClass: 'animation--highlight'}); this.setState({errorClass: 'animation--highlight'});
setTimeout(() => { setTimeout(() => {
this.setState({errorClass: null}); this.setState({errorClass: null});
}, 1000); }, Constants.ANIMATION_TIMEOUT);
return; return;
} }
@@ -218,6 +219,10 @@ export default class CreatePost extends React.Component {
draft.message = message; draft.message = message;
PostStore.storeCurrentDraft(draft); PostStore.storeCurrentDraft(draft);
this.checkMessageLength(message);
}
checkMessageLength(message) {
if (message.length > Constants.CHARACTER_LIMIT) { if (message.length > Constants.CHARACTER_LIMIT) {
const errorMessage = ( const errorMessage = (
<FormattedMessage <FormattedMessage
@@ -330,6 +335,8 @@ export default class CreatePost extends React.Component {
fullWidthTextBox: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_FULL_SCREEN, fullWidthTextBox: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_FULL_SCREEN,
showTutorialTip: tutorialStep === TutorialSteps.POST_POPOVER showTutorialTip: tutorialStep === TutorialSteps.POST_POPOVER
}); });
this.checkMessageLength(this.state.message);
} }
componentDidMount() { componentDidMount() {