diff options
author | David Thompson <dthompson@member.fsf.org> | 2013-04-13 10:42:40 -0400 |
---|---|---|
committer | David Thompson <dthompson@member.fsf.org> | 2013-04-13 10:42:40 -0400 |
commit | 99338b6a6419e6d8c044b82b2dd398a435e477f0 (patch) | |
tree | 0f72e528e924f3f66890ae113ea9c39a39310f5c /mediagoblin/user_pages/views.py | |
parent | aa4f958a40b933e94eb8ea86093eedf0bcc0e029 (diff) | |
download | mediagoblin-99338b6a6419e6d8c044b82b2dd398a435e477f0.tar.lz mediagoblin-99338b6a6419e6d8c044b82b2dd398a435e477f0.tar.xz mediagoblin-99338b6a6419e6d8c044b82b2dd398a435e477f0.zip |
Do not allow comments to be posted when they are disabled.
Diffstat (limited to 'mediagoblin/user_pages/views.py')
-rw-r--r-- | mediagoblin/user_pages/views.py | 8 |
1 files changed, 7 insertions, 1 deletions
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, |