diff --git a/app/models.py b/app/models.py index 7b954dc3..02ee3978 100644 --- a/app/models.py +++ b/app/models.py @@ -698,6 +698,7 @@ class User(UserMixin, db.Model): roles = db.relationship('Role', secondary=user_role, lazy='dynamic', cascade="all, delete") + hide_read_posts = db.Column(db.Boolean, default=False) read_post = db.relationship( 'Post', secondary=read_posts, primaryjoin=(read_posts.c.user_id == id), diff --git a/app/templates/user/edit_settings.html b/app/templates/user/edit_settings.html index b834d7b3..1742764e 100644 --- a/app/templates/user/edit_settings.html +++ b/app/templates/user/edit_settings.html @@ -27,6 +27,7 @@
Visibility
{{ render_field(form.searchable) }} {{ render_field(form.indexable) }} + {{ render_field(form.hide_read_posts) }}
Preferences
{{ render_field(form.interface_language) }} {{ render_field(form.markdown_editor) }} diff --git a/app/user/forms.py b/app/user/forms.py index 7a4b3e5a..92bf12d3 100644 --- a/app/user/forms.py +++ b/app/user/forms.py @@ -43,6 +43,7 @@ class SettingsForm(FlaskForm): markdown_editor = BooleanField(_l('Use markdown editor GUI when writing')) searchable = BooleanField(_l('Show profile in user list')) indexable = BooleanField(_l('My posts appear in search results')) + hide_read_posts = BooleanField(_l('Do not display posts with which I have already interacted (opened/upvote/downvote)')) manually_approves_followers = BooleanField(_l('Manually approve followers')) vote_privately = BooleanField(_l('Vote privately')) sorts = [('hot', _l('Hot')), diff --git a/app/user/routes.py b/app/user/routes.py index 623b87fa..2e3f23e0 100644 --- a/app/user/routes.py +++ b/app/user/routes.py @@ -379,6 +379,7 @@ def user_settings(): current_user.newsletter = form.newsletter.data current_user.searchable = form.searchable.data current_user.indexable = form.indexable.data + current_user.hide_read_posts = form.hide_read_posts.data current_user.default_sort = form.default_sort.data current_user.default_filter = form.default_filter.data current_user.theme = form.theme.data @@ -405,6 +406,7 @@ def user_settings(): form.email_unread.data = current_user.email_unread form.searchable.data = current_user.searchable form.indexable.data = current_user.indexable + form.hide_read_posts.data = current_user.hide_read_posts form.default_sort.data = current_user.default_sort form.default_filter.data = current_user.default_filter form.theme.data = current_user.theme