This commit is contained in:
cuom1999 2023-10-27 16:49:37 -05:00
commit b053c43b19
2 changed files with 8 additions and 3 deletions

View file

@ -144,14 +144,16 @@ class CommentedDetailView(TemplateResponseMixin, SingleObjectMixin, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
target_comment = None target_comment = None
self.object = self.get_object()
if "comment-id" in request.GET: if "comment-id" in request.GET:
comment_id = int(request.GET["comment-id"])
try: try:
comment_id = int(request.GET["comment-id"])
comment_obj = Comment.objects.get(id=comment_id) comment_obj = Comment.objects.get(id=comment_id)
except Comment.DoesNotExist: except (Comment.DoesNotExist, ValueError):
raise Http404
if comment_obj.linked_object != self.object:
raise Http404 raise Http404
target_comment = comment_obj.get_root() target_comment = comment_obj.get_root()
self.object = self.get_object()
return self.render_to_response( return self.render_to_response(
self.get_context_data( self.get_context_data(
object=self.object, object=self.object,

View file

@ -145,6 +145,8 @@
$comment_loading.hide(); $comment_loading.hide();
var $comment = $("#comment-" + id + "-children"); var $comment = $("#comment-" + id + "-children");
$comment.append(data); $comment.append(data);
MathJax.typeset($('#comments')[0]);
register_time($('.time-with-rel'));
} }
}) })
} }
@ -187,6 +189,7 @@
$comment.append(data); $comment.append(data);
} }
MathJax.typeset($('#comments')[0]); MathJax.typeset($('#comments')[0]);
register_time($('.time-with-rel'));
} }
}) })
} }