Added a check to prevent blank messages from being posted.
This commit is contained in:
parent
4d7a93a493
commit
7298ffa11b
@ -133,14 +133,19 @@ def media_post_comment(request):
|
||||
comment['media_entry'] = ObjectId(request.matchdict['media'])
|
||||
comment['author'] = request.user['_id']
|
||||
comment['content'] = unicode(request.POST['comment_content'])
|
||||
|
||||
comment['content_html'] = cleaned_markdown_conversion(comment['content'])
|
||||
|
||||
comment.save()
|
||||
if not comment['content'].strip():
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.ERROR,
|
||||
_("Empty comments are not allowed."))
|
||||
else:
|
||||
comment.save()
|
||||
|
||||
messages.add_message(
|
||||
request, messages.SUCCESS,
|
||||
'Comment posted!')
|
||||
messages.add_message(
|
||||
request, messages.SUCCESS,
|
||||
'Comment posted!')
|
||||
|
||||
return redirect(request, 'mediagoblin.user_pages.media_home',
|
||||
media = request.matchdict['media'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user