Do not allow comments to be posted when they are disabled.

This commit is contained in:
David Thompson 2013-04-13 10:42:40 -04:00
parent aa4f958a40
commit 99338b6a64

View File

@ -159,7 +159,13 @@ def media_post_comment(request, media):
comment.author = request.user.id comment.author = request.user.id
comment.content = unicode(request.form['comment_content']) comment.content = unicode(request.form['comment_content'])
if not comment.content.strip(): # Show error message if commenting is disabled.
if not mg_globals.app_config['allow_comments']:
messages.add_message(
request,
messages.ERROR,
_("Sorry, comments are disabled."))
elif not comment.content.strip():
messages.add_message( messages.add_message(
request, request,
messages.ERROR, messages.ERROR,