Make comment revision work again
This commit is contained in:
parent
d0511f46c0
commit
9f225157d2
2 changed files with 9 additions and 4 deletions
|
@ -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):
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
{% with node=revision.object %}
|
||||
<div class="comment-body">{{ node.body|markdown|reference|str|safe }}</div>
|
||||
{% endwith %}
|
||||
<div class="comment-body">{{ body|markdown|reference|str|safe }}</div>
|
||||
|
|
Loading…
Reference in a new issue