-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change comment style #70
Conversation
Thanks em! make_style.sh thì nên để 755 để có thể chạy được nhưng để anh sửa cũng được. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anh có vài góp ý nhỏ. Anh code lại trong 57ded6f luôn rồi.
if parrent_none: | ||
queryset = queryset.filter(parent=None, hidden=False) | ||
if (comment_remove != -1): | ||
queryset.get(pk=comment_remove).delete() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chỗ này tạo ra bug: comment bị xóa khỏi DB. Thay vào đó, dùng queryset.exclude
.annotate( | ||
count_replies=Count("replies", distinct=True), | ||
revisions=Count("versions", distinct=True), | ||
)[offset:offset+limit] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chỗ này có 1 bug khi pre_query != None. Khi đó offset = 1, và sau khi loại bỏ pre_query thì sẽ bị thiếu thằng 0 trong queryset. Đúng thì offset nên bằng 0 (và logic comment_more cần sửa chút)
{% else %} | ||
{% include "comments/content-list.html" %} | ||
{% endif %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic cái này và content-list gần như giống nhau. Mình có thể hợp vào làm một để tránh lặp code
@@ -151,40 +152,92 @@ def post(self, request, *args, **kwargs): | |||
return self.render_to_response(context) | |||
|
|||
def get(self, request, *args, **kwargs): | |||
pre_query = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nên dùng từ dễ hiểu hơn, ví dụ như target_comment thay vì pre_query
const queryString = window.location.search; | ||
const urlParams = new URLSearchParams(queryString); | ||
const comment_remove = urlParams.get('comment-id'); | ||
console.log(comment_remove); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log :))
Dạ vâng, em cảm ơn anh nhiều ạ ! |
No description provided.