]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/commands.py
admin recalculate denormalized data tool and fix in comment votes
[osqa.git] / forum / views / commands.py
index 89f3fb8aaaf78137897e2b4fe72b7895a039b0cf..4ff80f8c50529acf38462a9b8fee67a90ed6bd06 100644 (file)
@@ -107,7 +107,7 @@ def vote_post(request, id, vote_type):
     votes_left = int(settings.MAX_VOTES_PER_DAY) - user_vote_count_today + (vote_type == 'none' and -1 or 1)
 
     if int(settings.START_WARN_VOTES_LEFT) >= votes_left:
-        response['message'] = _("You have %(nvotes) %(tvotes) left today.") % \
+        response['message'] = _("You have %(nvotes)s %(tvotes)s left today.") % \
                     {'nvotes': votes_left, 'tvotes': ungettext('vote', 'votes', votes_left)}
 
     return response
@@ -232,17 +232,16 @@ def comment(request, id):
         if not user.can_comment(post):
             raise NotEnoughRepPointsException( _('comment'))
 
-        comment = Comment(user=user, node=post)
+        comment = Comment(parent=post)
 
     comment_text = request.POST.get('comment', '').strip()
 
     if not len(comment_text):
         raise Exception(_("Comment is empty"))
 
-    comment.comment=comment_text
-    comment.save()
+    comment.create_revision(user, body=comment_text)
 
-    if comment._is_new:
+    if comment.active_revision.revision == 1:
         return {
             'commands': {
                 'insert_comment': [