adding hide-read-posts setting for user settings

This commit is contained in:
Alan Roberts 2024-09-27 11:00:20 -04:00
parent 77745fdfec
commit c59556fab5
4 changed files with 5 additions and 0 deletions

View file

@ -698,6 +698,7 @@ class User(UserMixin, db.Model):
roles = db.relationship('Role', secondary=user_role, lazy='dynamic', cascade="all, delete") 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( read_post = db.relationship(
'Post', secondary=read_posts, 'Post', secondary=read_posts,
primaryjoin=(read_posts.c.user_id == id), primaryjoin=(read_posts.c.user_id == id),

View file

@ -27,6 +27,7 @@
<h5> Visibility </h5> <h5> Visibility </h5>
{{ render_field(form.searchable) }} {{ render_field(form.searchable) }}
{{ render_field(form.indexable) }} {{ render_field(form.indexable) }}
{{ render_field(form.hide_read_posts) }}
<h5> Preferences </h5> <h5> Preferences </h5>
{{ render_field(form.interface_language) }} {{ render_field(form.interface_language) }}
{{ render_field(form.markdown_editor) }} {{ render_field(form.markdown_editor) }}

View file

@ -43,6 +43,7 @@ class SettingsForm(FlaskForm):
markdown_editor = BooleanField(_l('Use markdown editor GUI when writing')) markdown_editor = BooleanField(_l('Use markdown editor GUI when writing'))
searchable = BooleanField(_l('Show profile in user list')) searchable = BooleanField(_l('Show profile in user list'))
indexable = BooleanField(_l('My posts appear in search results')) 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')) manually_approves_followers = BooleanField(_l('Manually approve followers'))
vote_privately = BooleanField(_l('Vote privately')) vote_privately = BooleanField(_l('Vote privately'))
sorts = [('hot', _l('Hot')), sorts = [('hot', _l('Hot')),

View file

@ -379,6 +379,7 @@ def user_settings():
current_user.newsletter = form.newsletter.data current_user.newsletter = form.newsletter.data
current_user.searchable = form.searchable.data current_user.searchable = form.searchable.data
current_user.indexable = form.indexable.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_sort = form.default_sort.data
current_user.default_filter = form.default_filter.data current_user.default_filter = form.default_filter.data
current_user.theme = form.theme.data current_user.theme = form.theme.data
@ -405,6 +406,7 @@ def user_settings():
form.email_unread.data = current_user.email_unread form.email_unread.data = current_user.email_unread
form.searchable.data = current_user.searchable form.searchable.data = current_user.searchable
form.indexable.data = current_user.indexable 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_sort.data = current_user.default_sort
form.default_filter.data = current_user.default_filter form.default_filter.data = current_user.default_filter
form.theme.data = current_user.theme form.theme.data = current_user.theme