Merge branch 'master' of https://github.com/zhaospei/online-judge
This commit is contained in:
commit
e02675279d
4 changed files with 21 additions and 9 deletions
|
@ -165,8 +165,10 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
|
|||
context["replies"] = len(queryset.filter(parent=None))
|
||||
queryset = (
|
||||
queryset.filter(parent=None)[:10].select_related("author__user")
|
||||
.filter(hidden=False)
|
||||
.defer("author__about")
|
||||
.annotate(revisions=Count("versions")).annotate(count_replies=Count("replies"))
|
||||
.annotate(revisions=Count("versions"))
|
||||
.annotate(count_replies=Count("replies"))
|
||||
)
|
||||
context["has_comments"] = queryset.exists()
|
||||
context["comment_lock"] = self.is_comment_locked()
|
||||
|
|
|
@ -30,6 +30,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",
|
||||
|
@ -188,7 +190,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):
|
||||
|
|
|
@ -37,6 +37,11 @@ a {
|
|||
border: 1px solid #CCC;
|
||||
}
|
||||
|
||||
.comment-img {
|
||||
display: flex;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.new-comments .comment-display {
|
||||
display: flex;
|
||||
margin-top: -0.25em !important;
|
||||
|
@ -47,9 +52,8 @@ a {
|
|||
}
|
||||
|
||||
.new-comments .comment .detail {
|
||||
margin: 0px 15px 0px;
|
||||
width: 100%;
|
||||
max-width: calc(100% - 134px);
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.new-comments .comment-edits {
|
||||
|
@ -64,6 +68,7 @@ a {
|
|||
border-bottom: 1px #888 solid;
|
||||
color: #888;
|
||||
text-align: right;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.previous-revision, .next-revision {
|
||||
|
@ -80,8 +85,8 @@ a {
|
|||
}
|
||||
|
||||
.new-comments .gravatar {
|
||||
width: 75px;
|
||||
max-width: 75px;
|
||||
width: 1.5em;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.new-comments .vote {
|
||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue