Marks new comments in topics since your last visit, and which topics have any
+
diff --git a/tildes/tildes/templates/settings_comment_visits.jinja2 b/tildes/tildes/templates/settings_comment_visits.jinja2
deleted file mode 100644
index 494d085..0000000
--- a/tildes/tildes/templates/settings_comment_visits.jinja2
+++ /dev/null
@@ -1,63 +0,0 @@
-{# Copyright (c) 2018 Tildes contributors #}
-{# SPDX-License-Identifier: AGPL-3.0-or-later #}
-
-{% extends 'base_settings.jinja2' %}
-
-{% block title %}Toggle marking new comments{% endblock %}
-
-{% block main_heading %}Toggle marking new comments{% endblock %}
-
-{% block settings %}
-
- How new comments are displayed
-
-
-
-
Tildes can mark which comments were posted since your previous visit to a topic's comments (and which topics have any new ones), but doing so requires keeping track of when that previous visit happened. This has a privacy implication, so the feature is opt-in.
-
-
While this feature is enabled, we will record and store data about your most recent visit to each topic's comments. We store only the single most recent visit—any previous visit data for that topic is replaced if you visit the same one again later.
-
-
This data is retained for 30 days. After not visiting a particular topic for 30 days, the data about your last visit to it will be deleted.
-
-
Disabling the feature will stop marking comments but will not delete any existing data, only prevent new data from being stored. The previously-stored data will be deleted after 30 days, as usual.
- {# Display the "Collapse read" button if the user is tracking comment visits
- but not automatically collapsing old comments, and there are new comments #}
+ {# Display the "Collapse read" button if the user is not automatically
+ collapsing old comments, and there are new comments #}
{% if request.user
- and request.user.track_comment_visits
and not request.user.collapse_old_comments
and topic.comments_since_last_visit %}
diff --git a/tildes/tildes/views/api/web/comment.py b/tildes/tildes/views/api/web/comment.py
index 9ed5ed6..1160378 100644
--- a/tildes/tildes/views/api/web/comment.py
+++ b/tildes/tildes/views/api/web/comment.py
@@ -50,32 +50,30 @@ def _mark_comment_read_from_interaction(request: Request, comment: Comment) -> N
def _increment_topic_comments_seen(request: Request, comment: Comment) -> None:
"""Increment the number of comments in a topic the user has viewed.
- If the user has the "track comment visits" feature enabled, we want to increment the
- number of comments they've seen in the thread that the comment came from, so that
- they don't *both* get a notification as well as have the thread highlight with "(1
- new)". This should only happen if their last visit was before the comment was
- posted, however. Below, this is implemented as a INSERT ... ON CONFLICT DO UPDATE
- so that it will insert a new topic visit with 1 comment if they didn't previously
- have one at all.
+ We want to increment the number of comments they've seen in the thread that the
+ comment came from, so that they don't *both* get a notification as well as have the
+ thread highlight with "(1 new)". This should only happen if their last visit was
+ before the comment was posted, however. Below, this is implemented as a
+ INSERT ... ON CONFLICT DO UPDATE so that it will insert a new topic visit with
+ 1 comment if they didn't previously have one at all.
"""
- if request.user.track_comment_visits:
- statement = (
- insert(TopicVisit.__table__)
- .values(
- user_id=request.user.user_id,
- topic_id=comment.topic_id,
- visit_time=utc_now(),
- num_comments=1,
- )
- .on_conflict_do_update(
- constraint=TopicVisit.__table__.primary_key,
- set_={"num_comments": TopicVisit.num_comments + 1},
- where=TopicVisit.visit_time < comment.created_time,
- )
+ statement = (
+ insert(TopicVisit.__table__)
+ .values(
+ user_id=request.user.user_id,
+ topic_id=comment.topic_id,
+ visit_time=utc_now(),
+ num_comments=1,
)
+ .on_conflict_do_update(
+ constraint=TopicVisit.__table__.primary_key,
+ set_={"num_comments": TopicVisit.num_comments + 1},
+ where=TopicVisit.visit_time < comment.created_time,
+ )
+ )
- request.db_session.execute(statement)
- mark_changed(request.db_session)
+ request.db_session.execute(statement)
+ mark_changed(request.db_session)
@ic_view_config(
diff --git a/tildes/tildes/views/api/web/user.py b/tildes/tildes/views/api/web/user.py
index 16d3e8a..b205f22 100644
--- a/tildes/tildes/views/api/web/user.py
+++ b/tildes/tildes/views/api/web/user.py
@@ -213,22 +213,6 @@ def patch_change_open_links_new_tab(request: Request) -> Response:
return IC_NOOP
-@ic_view_config(
- route_name="user",
- request_method="PATCH",
- request_param="ic-trigger-name=comment-visits",
- permission="change_comment_visits_setting",
-)
-def patch_change_track_comment_visits(request: Request) -> Response:
- """Change the user's "track comment visits" setting."""
- user = request.context
-
- track_comment_visits = bool(request.params.get("track_comment_visits"))
- user.track_comment_visits = track_comment_visits
-
- return IC_NOOP
-
-
@ic_view_config(
route_name="user",
request_method="PATCH",
diff --git a/tildes/tildes/views/settings.py b/tildes/tildes/views/settings.py
index 9324b38..2cd2c6a 100644
--- a/tildes/tildes/views/settings.py
+++ b/tildes/tildes/views/settings.py
@@ -86,15 +86,6 @@ def get_settings_two_factor(request: Request) -> dict:
}
-@view_config(
- route_name="settings_comment_visits", renderer="settings_comment_visits.jinja2"
-)
-def get_settings_comment_visits(request: Request) -> dict:
- """Generate the comment visits settings page."""
- # pylint: disable=unused-argument
- return {}
-
-
@view_config(route_name="settings_filters", renderer="settings_filters.jinja2")
def get_settings_filters(request: Request) -> dict:
"""Generate the filters settings page."""
diff --git a/tildes/tildes/views/topic.py b/tildes/tildes/views/topic.py
index 904b7f6..c56f4bc 100644
--- a/tildes/tildes/views/topic.py
+++ b/tildes/tildes/views/topic.py
@@ -440,8 +440,7 @@ def get_topic(request: Request, comment_order: CommentTreeSortOption) -> dict:
tree.collapse_from_labels()
- # if the user has the "mark new comments" feature enabled
- if request.user and request.user.track_comment_visits:
+ if request.user:
# update their last visit time for this topic
statement = TopicVisit.generate_insert_statement(request.user, topic)
request.db_session.execute(statement)