From 106a9cf7cfb52ecff1e12ebbf8ce0675dc8b62b5 Mon Sep 17 00:00:00 2001 From: Chad Birch Date: Sun, 7 Apr 2019 17:20:59 -0600 Subject: [PATCH] Update topic visits through interaction-marking This should have been included and was just missed, the topic visits weren't updating correctly without this. --- tildes/tildes/views/api/web/comment.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tildes/tildes/views/api/web/comment.py b/tildes/tildes/views/api/web/comment.py index 7d9bd11..6e71f39 100644 --- a/tildes/tildes/views/api/web/comment.py +++ b/tildes/tildes/views/api/web/comment.py @@ -131,6 +131,7 @@ def post_comment_reply(request: Request, markdown: str) -> dict: CommentNotification.comment == parent_comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, parent_comment) # commit and then re-query the new comment to get complete data request.tm.commit() @@ -220,6 +221,7 @@ def put_vote_comment(request: Request) -> dict: CommentNotification.comment == comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, comment) try: # manually flush before attempting to commit, to avoid having all objects @@ -262,6 +264,7 @@ def delete_vote_comment(request: Request) -> dict: CommentNotification.comment == comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, comment) # manually commit the transaction so triggers will execute request.tm.commit() @@ -310,6 +313,7 @@ def put_label_comment( CommentNotification.comment == comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, comment) try: # manually flush before attempting to commit, to avoid having all objects @@ -354,6 +358,7 @@ def delete_label_comment(request: Request, name: CommentLabelOption) -> Response CommentNotification.comment == comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, comment) # commit and then re-query the comment to get complete data request.tm.commit() @@ -457,6 +462,7 @@ def put_comment_bookmark(request: Request) -> dict: CommentNotification.comment == comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, comment) try: # manually flush before attempting to commit, to avoid having all @@ -499,6 +505,7 @@ def delete_comment_bookmark(request: Request) -> dict: CommentNotification.comment == comment, CommentNotification.is_unread == True, # noqa ).update({"is_unread": False}, synchronize_session=False) + _increment_topic_comments_seen(request, comment) # commit and then re-query the comment to get complete data request.tm.commit()