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