From 99338b6a6419e6d8c044b82b2dd398a435e477f0 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 13 Apr 2013 10:42:40 -0400 Subject: [PATCH] Do not allow comments to be posted when they are disabled. --- mediagoblin/user_pages/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py index 61c23f16..b3e613c4 100644 --- a/mediagoblin/user_pages/views.py +++ b/mediagoblin/user_pages/views.py @@ -159,7 +159,13 @@ def media_post_comment(request, media): comment.author = request.user.id 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( request, messages.ERROR,