for some reason people seem to not understand why you can not submit close to empty posts, fix that

This commit is contained in:
Sam Saffron 2013-02-15 12:20:00 +11:00
parent e94b6e7796
commit 6132373fab
2 changed files with 20 additions and 7 deletions

View File

@ -335,14 +335,16 @@ window.Discourse.Composer = Discourse.Model.extend
saveDraft: -> saveDraft: ->
return if @disableDrafts return if @get('disableDrafts')
return unless @get('reply')
return if @get('reply').length < Discourse.SiteSettings.min_post_length
data = data =
reply: @get("reply"), reply: @get('reply'),
action: @get("action"), action: @get('action'),
title: @get("title"), title: @get('title'),
categoryName: @get("categoryName"), categoryName: @get('categoryName'),
postId: @get("post.id"), postId: @get('post.id'),
archetypeId: @get('archetypeId') archetypeId: @get('archetypeId')
metaData: @get('metaData') metaData: @get('metaData')
usernames: @get('targetUsernames') usernames: @get('targetUsernames')
@ -356,7 +358,14 @@ window.Discourse.Composer = Discourse.Model.extend
) )
resetDraftStatus: (-> resetDraftStatus: (->
@set('draftStatus', null) reply = @get('reply')
len = Discourse.SiteSettings.min_post_length
if !reply
@set('draftStatus', Em.String.i18n('composer.min_length.at_least', n: len))
else if reply.length < len
@set('draftStatus', Em.String.i18n('composer.min_length.more', n: len - reply.length))
else
@set('draftStatus', null)
).observes('reply','title') ).observes('reply','title')

View File

@ -244,6 +244,10 @@ en:
saved_draft_tip: "saved" saved_draft_tip: "saved"
saved_local_draft_tip: "saved locally" saved_local_draft_tip: "saved locally"
min_length:
at_least: "enter at least {{n}} characters"
more: "{{n}} to go..."
save_edit: "Save Edit" save_edit: "Save Edit"
reply: "Reply" reply: "Reply"
create_topic: "Create Topic" create_topic: "Create Topic"