diff --git a/tildes/alembic/versions/6c840340ab86_drop_track_comment_visits_column_on_.py b/tildes/alembic/versions/6c840340ab86_drop_track_comment_visits_column_on_.py new file mode 100644 index 0000000..0e0f072 --- /dev/null +++ b/tildes/alembic/versions/6c840340ab86_drop_track_comment_visits_column_on_.py @@ -0,0 +1,32 @@ +"""Drop track_comment_visits column on users + +Revision ID: 6c840340ab86 +Revises: cc12ea6c616d +Create Date: 2020-01-27 21:42:25.565355 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "6c840340ab86" +down_revision = "cc12ea6c616d" +branch_labels = None +depends_on = None + + +def upgrade(): + op.drop_column("users", "track_comment_visits") + + +def downgrade(): + op.add_column( + "users", + sa.Column( + "track_comment_visits", + sa.BOOLEAN(), + server_default=sa.text("false"), + nullable=False, + ), + ) diff --git a/tildes/scripts/clean_private_data.py b/tildes/scripts/clean_private_data.py index 66eb42f..408a8d8 100644 --- a/tildes/scripts/clean_private_data.py +++ b/tildes/scripts/clean_private_data.py @@ -192,7 +192,6 @@ class DataCleaner: "two_factor_backup_codes": DEFAULT, "inviter_id": DEFAULT, "invite_codes_remaining": DEFAULT, - "track_comment_visits": DEFAULT, "collapse_old_comments": DEFAULT, "auto_mark_notifications_read": DEFAULT, "open_new_tab_external": DEFAULT, diff --git a/tildes/static/images/mark-new-comments.png b/tildes/static/images/mark-new-comments.png deleted file mode 100644 index 9b84d9e..0000000 Binary files a/tildes/static/images/mark-new-comments.png and /dev/null differ diff --git a/tildes/tildes/lib/message.py b/tildes/tildes/lib/message.py index b563d6d..4455ae1 100644 --- a/tildes/tildes/lib/message.py +++ b/tildes/tildes/lib/message.py @@ -22,7 +22,6 @@ There's a page on the Docs site that explains the basic mechanics on Tildes: htt There are multiple useful links in the sidebar on your user page—get there by clicking your username in the top right, or in the sidebar if you're on mobile. You can access the settings page from there, which includes multiple things you'll probably want to do: * Check the available options for display themes (including dark themes) -* [Enable marking new comments in threads](https://tildes.net/settings/comment_visits) * [Set up account recovery in case you lose access to your account](https://tildes.net/settings/account_recovery) # Please post topics and comments diff --git a/tildes/tildes/models/topic/topic_query.py b/tildes/tildes/models/topic/topic_query.py index d14dc95..7218f36 100644 --- a/tildes/tildes/models/topic/topic_query.py +++ b/tildes/tildes/models/topic/topic_query.py @@ -7,7 +7,7 @@ from typing import Any, Sequence from pyramid.request import Request from sqlalchemy import func -from sqlalchemy.sql.expression import and_, label, null +from sqlalchemy.sql.expression import and_, label from tildes.enums import TopicSortOption from tildes.lib.datetime import SimpleHoursPeriod, utc_now @@ -94,21 +94,14 @@ class TopicQuery(PaginatedQuery): def _attach_visit_data(self) -> "TopicQuery": """Join the data related to the user's last visit to the topic(s).""" - # pylint: disable=assignment-from-no-return - if self.request.user.track_comment_visits: - query = self.outerjoin( - TopicVisit, - and_( - TopicVisit.topic_id == Topic.topic_id, - TopicVisit.user == self.request.user, - ), - ) - query = query.add_columns(TopicVisit.visit_time, TopicVisit.num_comments) - else: - # if the user has the feature disabled, just add literal NULLs - query = self.add_columns( - null().label("visit_time"), null().label("num_comments") - ) + query = self.outerjoin( + TopicVisit, + and_( + TopicVisit.topic_id == Topic.topic_id, + TopicVisit.user == self.request.user, + ), + ) + query = query.add_columns(TopicVisit.visit_time, TopicVisit.num_comments) return query diff --git a/tildes/tildes/models/user/user.py b/tildes/tildes/models/user/user.py index a322030..81c16b9 100644 --- a/tildes/tildes/models/user/user.py +++ b/tildes/tildes/models/user/user.py @@ -89,7 +89,6 @@ class User(DatabaseModel): num_unread_notifications: int = Column(Integer, nullable=False, server_default="0") inviter_id: int = Column(Integer, ForeignKey("users.user_id")) invite_codes_remaining: int = Column(Integer, nullable=False, server_default="0") - track_comment_visits: bool = Column(Boolean, nullable=False, server_default="false") collapse_old_comments: bool = Column(Boolean, nullable=False, server_default="true") auto_mark_notifications_read: bool = Column( Boolean, nullable=False, server_default="false" diff --git a/tildes/tildes/routes.py b/tildes/tildes/routes.py index 5189eaa..cb55137 100644 --- a/tildes/tildes/routes.py +++ b/tildes/tildes/routes.py @@ -93,9 +93,6 @@ def includeme(config: Configurator) -> None: "/two_factor/qr_code", factory=LoggedInFactory, ) - config.add_route( - "settings_comment_visits", "/comment_visits", factory=LoggedInFactory - ) config.add_route("settings_filters", "/filters", factory=LoggedInFactory) config.add_route("settings_bio", "/bio", factory=LoggedInFactory) config.add_route( diff --git a/tildes/tildes/schemas/user.py b/tildes/tildes/schemas/user.py index 53a4826..2f889f9 100644 --- a/tildes/tildes/schemas/user.py +++ b/tildes/tildes/schemas/user.py @@ -8,7 +8,7 @@ from typing import Any from marshmallow import post_dump, pre_load, Schema, validates, validates_schema from marshmallow.exceptions import ValidationError -from marshmallow.fields import Boolean, DateTime, Email, String +from marshmallow.fields import DateTime, Email, String from marshmallow.validate import Length, Regexp from tildes.lib.password import is_breached_password @@ -57,7 +57,6 @@ class UserSchema(Schema): email_address = Email(allow_none=True, load_only=True) email_address_note = String(validate=Length(max=EMAIL_ADDRESS_NOTE_MAX_LENGTH)) created_time = DateTime(dump_only=True) - track_comment_visits = Boolean() bio_markdown = Markdown(max_length=BIO_MAX_LENGTH, allow_none=True) @post_dump diff --git a/tildes/tildes/templates/settings.jinja2 b/tildes/tildes/templates/settings.jinja2 index 25ffb27..65964e4 100644 --- a/tildes/tildes/templates/settings.jinja2 +++ b/tildes/tildes/templates/settings.jinja2 @@ -74,8 +74,24 @@