diff --git a/judge/views/comment.py b/judge/views/comment.py index 962d9f1..19085fb 100644 --- a/judge/views/comment.py +++ b/judge/views/comment.py @@ -24,6 +24,8 @@ from judge.utils.views import TitleMixin from judge.widgets import MathJaxPagedownWidget, HeavyPreviewPageDownWidget from judge.comments import add_mention_notifications, del_mention_notifications +import json + __all__ = [ "upvote_comment", "downvote_comment", @@ -120,7 +122,12 @@ class CommentRevisionAjax(CommentMixin, DetailView): ) except ValueError: raise Http404 - context["revision"] = revisions[wanted] + revision = revisions[wanted] + data = json.loads(revision.serialized_data) + try: + context["body"] = data[0]["fields"]["body"] + except Exception: + context["body"] = "" return context def get_object(self, queryset=None): diff --git a/templates/comments/revision-ajax.html b/templates/comments/revision-ajax.html index 6c6360a..4a2091e 100644 --- a/templates/comments/revision-ajax.html +++ b/templates/comments/revision-ajax.html @@ -1,3 +1 @@ -{% with node=revision.object %} -
{{ node.body|markdown|reference|str|safe }}
-{% endwith %} +
{{ body|markdown|reference|str|safe }}