Browse Source

Rename is_new to new_comment in API

merge-requests/166/head
Andrew Shu 2 months ago
parent
commit
d2fd058be7
  1. 2
      tildes/openapi_beta.yaml
  2. 6
      tildes/tildes/views/api/beta/comment.py

2
tildes/openapi_beta.yaml

@ -385,7 +385,7 @@ components:
by_me:
type: boolean
nullable: true
is_new:
new_comment:
type: boolean
nullable: true
voted:

6
tildes/tildes/views/api/beta/comment.py

@ -17,7 +17,7 @@ def comment_to_dict(request: Request, comment: Comment) -> dict:
exemplary = None
by_op = None
by_me = None
is_new = None
is_new_comment = None
if request.has_permission("view", comment):
author = comment.user.username
rendered_html = comment.rendered_html
@ -25,7 +25,7 @@ def comment_to_dict(request: Request, comment: Comment) -> dict:
by_me = request.user == comment.user if request.user else False
if request.has_permission("view_author", comment.topic):
by_op = comment.user == comment.topic.user
is_new = (
is_new_comment = (
(comment.created_time > comment.topic.last_visit_time)
if (
hasattr(comment.topic, "last_visit_time")
@ -60,7 +60,7 @@ def comment_to_dict(request: Request, comment: Comment) -> dict:
),
"by_op": by_op,
"by_me": by_me,
"is_new": is_new,
"new_comment": is_new_comment,
"voted": comment.user_voted,
"bookmarked": comment.user_bookmarked,
}

Loading…
Cancel
Save