FIX: Incorrect error message when post isn't long enough

This commit is contained in:
Robin Ward 2015-05-08 13:23:43 -04:00
parent 3830bb7d78
commit a93dfece70
2 changed files with 9 additions and 6 deletions

View File

@ -1,10 +1,12 @@
import StringBuffer from 'discourse/mixins/string-buffer';
import { iconHTML } from 'discourse/helpers/fa-icon'; import { iconHTML } from 'discourse/helpers/fa-icon';
export default Ember.Component.extend({ export default Ember.Component.extend(StringBuffer, {
classNameBindings: [':popup-tip', 'good', 'bad', 'shownAt::hide'], classNameBindings: [':popup-tip', 'good', 'bad', 'shownAt::hide'],
animateAttribute: null, animateAttribute: null,
bouncePixels: 6, bouncePixels: 6,
bounceDelay: 100, bounceDelay: 100,
rerenderTriggers: ['validation.reason'],
click() { click() {
this.set('shownAt', false); this.set('shownAt', false);
@ -32,7 +34,7 @@ export default Ember.Component.extend({
} }
}.observes('shownAt'), }.observes('shownAt'),
render(buffer) { renderString(buffer) {
const reason = this.get('validation.reason'); const reason = this.get('validation.reason');
if (!reason) { return; } if (!reason) { return; }

View File

@ -564,6 +564,7 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
replyValidation: function() { replyValidation: function() {
const replyLength = this.get('model.replyLength'), const replyLength = this.get('model.replyLength'),
missingChars = this.get('model.missingReplyCharacters'); missingChars = this.get('model.missingReplyCharacters');
let reason; let reason;
if (replyLength < 1) { if (replyLength < 1) {
reason = I18n.t('composer.error.post_missing'); reason = I18n.t('composer.error.post_missing');
@ -576,7 +577,7 @@ const ComposerView = Discourse.View.extend(Ember.Evented, {
} }
if (reason) { if (reason) {
return Discourse.InputValidation.create({ failed: true, reason: reason }); return Discourse.InputValidation.create({ failed: true, reason });
} }
}.property('model.reply', 'model.replyLength', 'model.missingReplyCharacters', 'model.minimumPostLength'), }.property('model.reply', 'model.replyLength', 'model.missingReplyCharacters', 'model.minimumPostLength'),