aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2011-10-15 14:59:52 +0200
committerElrond <elrond+mediagoblin.org@samba-tng.org>2011-10-15 14:59:52 +0200
commitb81926f614af846271a2f8eb169eabd066fd1888 (patch)
treea50774efba108d9fdd947ae8a8322c53f625cb25
parent404d8fa9ae6e305f7b06750b67b5dac1d9634af2 (diff)
parent2b3a50db43d672c481cbca7eafda3a4cd8e05509 (diff)
downloadmediagoblin-b81926f614af846271a2f8eb169eabd066fd1888.tar.lz
mediagoblin-b81926f614af846271a2f8eb169eabd066fd1888.tar.xz
mediagoblin-b81926f614af846271a2f8eb169eabd066fd1888.zip
Merge remote branch 'aaronw/bug601_blank_comments'
* aaronw/bug601_blank_comments: Make Comment posted! translatable. Update english translation file. Added a check to prevent blank messages from being posted. Conflicts: mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po
-rw-r--r--mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po6
-rw-r--r--mediagoblin/user_pages/views.py15
2 files changed, 15 insertions, 6 deletions
diff --git a/mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po b/mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po
index 4d178b9c..c6ed08d7 100644
--- a/mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po
+++ b/mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po
@@ -480,7 +480,11 @@ msgstr ""
msgid "I am sure I want to delete this"
msgstr ""
-#: mediagoblin/user_pages/views.py:176
+#: mediagoblin/user_pages/views.py:142
+msgid "Empty comments are not allowed."
+msgstr ""
+
+#: mediagoblin/user_pages/views.py:181
msgid "You are about to delete another user's media. Proceed with caution."
msgstr ""
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 9cec74dc..4cd56b75 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -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'],