diff --git a/tildes/alembic/versions/fef2c9c9a186_user_add_interact_mark_notifications_.py b/tildes/alembic/versions/fef2c9c9a186_user_add_interact_mark_notifications_.py new file mode 100644 index 0000000..8cbf1b7 --- /dev/null +++ b/tildes/alembic/versions/fef2c9c9a186_user_add_interact_mark_notifications_.py @@ -0,0 +1,32 @@ +"""User: add interact_mark_notifications_read + +Revision ID: fef2c9c9a186 +Revises: beaa57144e49 +Create Date: 2019-04-01 13:21:38.441021 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = "fef2c9c9a186" +down_revision = "beaa57144e49" +branch_labels = None +depends_on = None + + +def upgrade(): + op.add_column( + "users", + sa.Column( + "interact_mark_notifications_read", + sa.Boolean(), + server_default="true", + nullable=False, + ), + ) + + +def downgrade(): + op.drop_column("users", "interact_mark_notifications_read") diff --git a/tildes/tildes/models/user/user.py b/tildes/tildes/models/user/user.py index 7308e61..f3acfd3 100644 --- a/tildes/tildes/models/user/user.py +++ b/tildes/tildes/models/user/user.py @@ -96,6 +96,9 @@ class User(DatabaseModel): auto_mark_notifications_read: bool = Column( Boolean, nullable=False, server_default="false" ) + interact_mark_notifications_read: bool = Column( + Boolean, nullable=False, server_default="true" + ) open_new_tab_external: bool = Column( Boolean, nullable=False, server_default="false" ) diff --git a/tildes/tildes/templates/notifications_unread.jinja2 b/tildes/tildes/templates/notifications_unread.jinja2 index 012914c..428a13f 100644 --- a/tildes/tildes/templates/notifications_unread.jinja2 +++ b/tildes/tildes/templates/notifications_unread.jinja2 @@ -68,6 +68,10 @@ {% endif %} {% endif %} + + {% if request.user.interact_mark_notifications_read %} +
Comments will be automatically marked read when you take an action on them (such as voting or replying). They will not disappear from the unread page until reloading. If you prefer to always mark them manually, you can disable this behavior on the Settings page.
+ {% endif %} {% else %}No unread notifications.
Go to previously read notifications
diff --git a/tildes/tildes/templates/settings.jinja2 b/tildes/tildes/templates/settings.jinja2 index 4107bcb..5f5f8f5 100644 --- a/tildes/tildes/templates/settings.jinja2 +++ b/tildes/tildes/templates/settings.jinja2 @@ -36,6 +36,28 @@ + +