diff --git a/app/admin/forms.py b/app/admin/forms.py index 8a08f153..5c67e68d 100644 --- a/app/admin/forms.py +++ b/app/admin/forms.py @@ -131,9 +131,9 @@ class AddUserForm(FlaskForm): (3, _l('Make semi-transparent'))] ignore_bots = SelectField(_l('Hide posts by bots'), choices=hide_type_choices, default=0, coerce=int, render_kw={'class': 'form-select'}) - show_nsfw = SelectField(_l('Show NSFW posts'), choices=hide_type_choices, default=1, + hide_nsfw = SelectField(_l('Show NSFW posts'), choices=hide_type_choices, default=1, coerce=int, render_kw={'class': 'form-select'}) - show_nsfl = SelectField(_l('Show NSFL posts'), choices=hide_type_choices, default=1, + hide_nsfl = SelectField(_l('Show NSFL posts'), choices=hide_type_choices, default=1, coerce=int, render_kw={'class': 'form-select'}) nsfw = BooleanField(_l('Show NSFW posts')) @@ -192,9 +192,9 @@ class EditUserForm(FlaskForm): (1, _l('Hide completely')), (2, _l('Blur')), (3, _l('Make semi-transparent'))] - show_nsfw = SelectField(_l('Show NSFW posts'), choices=hide_type_choices, default=1, + hide_nsfw = SelectField(_l('Show NSFW posts'), choices=hide_type_choices, default=1, coerce=int, render_kw={'class': 'form-select'}) - show_nsfl = SelectField(_l('Show NSFL posts'), choices=hide_type_choices, default=1, + hide_nsfl = SelectField(_l('Show NSFL posts'), choices=hide_type_choices, default=1, coerce=int, render_kw={'class': 'form-select'}) role_options = [(2, _l('User')), (3, _l('Staff')), diff --git a/app/admin/routes.py b/app/admin/routes.py index ccfb54ac..e88a4f3f 100644 --- a/app/admin/routes.py +++ b/app/admin/routes.py @@ -743,8 +743,8 @@ def admin_user_edit(user_id): if form.validate_on_submit(): user.bot = form.bot.data user.banned = form.banned.data - user.show_nsfw = form.show_nsfw.data - user.show_nsfl = form.show_nsfl.data + user.hide_nsfw = form.hide_nsfw.data + user.hide_nsfl = form.hide_nsfl.data if form.verified.data and not user.verified: finalize_user_setup(user) user.verified = form.verified.data @@ -776,8 +776,8 @@ def admin_user_edit(user_id): form.bot.data = user.bot form.verified.data = user.verified form.banned.data = user.banned - form.show_nsfw.data = user.show_nsfw - form.show_nsfl.data = user.show_nsfl + form.hide_nsfw.data = user.hide_nsfw + form.hide_nsfl.data = user.hide_nsfl if user.roles and user.roles.count() > 0: form.role.data = user.roles[0].id @@ -832,8 +832,8 @@ def admin_users_add(): user.cover = file user.newsletter = form.newsletter.data user.ignore_bots = form.ignore_bots.data - user.show_nsfw = form.show_nsfw.data - user.show_nsfl = form.show_nsfl.data + user.hide_nsfw = form.hide_nsfw.data + user.hide_nsfl = form.hide_nsfl.data user.instance_id = 1 user.roles.append(Role.query.get(form.role.data)) diff --git a/app/cli.py b/app/cli.py index 6d610f9c..1006e6ea 100644 --- a/app/cli.py +++ b/app/cli.py @@ -332,9 +332,9 @@ def register(app): posts = posts.filter(CommunityMember.user_id == user.id) if user.ignore_bots == 1: posts = posts.filter(Post.from_bot == False) - if user.show_nsfl == 1: + if user.hide_nsfl == 1: posts = posts.filter(Post.nsfl == False) - if user.show_nsfw == 1: + if user.hide_nsfw == 1: posts = posts.filter(Post.nsfw == False) domains_ids = blocked_domains(user.id) if domains_ids: diff --git a/app/community/routes.py b/app/community/routes.py index 1d51014c..750347a3 100644 --- a/app/community/routes.py +++ b/app/community/routes.py @@ -203,9 +203,9 @@ def show_community(community: Community): else: if current_user.ignore_bots == 1: posts = posts.filter(Post.from_bot == False) - if current_user.show_nsfl == 1: + if current_user.hide_nsfl == 1: posts = posts.filter(Post.nsfl == False) - if current_user.show_nsfw == 1: + if current_user.hide_nsfw == 1: posts = posts.filter(Post.nsfw == False) content_filters = user_filters_posts(current_user.id) posts = posts.filter(Post.deleted == False) diff --git a/app/main/routes.py b/app/main/routes.py index 070ceb47..a5287fc2 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -99,9 +99,9 @@ def home_page(type, sort): if current_user.ignore_bots == 1: posts = posts.filter(Post.from_bot == False) - if current_user.show_nsfl == 1: + if current_user.hide_nsfl == 1: posts = posts.filter(Post.nsfl == False) - if current_user.show_nsfw == 1: + if current_user.hide_nsfw == 1: posts = posts.filter(Post.nsfw == False) domains_ids = blocked_domains(current_user.id) @@ -211,9 +211,9 @@ def list_communities(): banned_from = communities_banned_from(current_user.id) if banned_from: communities = communities.filter(Community.id.not_in(banned_from)) - if current_user.show_nsfw == 1: + if current_user.hide_nsfw == 1: communities = communities.filter(Community.nsfw == False) - if current_user.show_nsfl == 1: + if current_user.hide_nsfl == 1: communities = communities.filter(Community.nsfl == False) else: communities = communities.filter(and_(Community.nsfw == False, Community.nsfl == False)) @@ -263,9 +263,9 @@ def list_local_communities(): banned_from = communities_banned_from(current_user.id) if banned_from: communities = communities.filter(Community.id.not_in(banned_from)) - if current_user.show_nsfw == 1: + if current_user.hide_nsfw == 1: communities = communities.filter(Community.nsfw == False) - if current_user.show_nsfl == 1: + if current_user.hide_nsfl == 1: communities = communities.filter(Community.nsfl == False) else: communities = communities.filter(and_(Community.nsfw == False, Community.nsfl == False)) @@ -442,9 +442,9 @@ def test(): posts = posts.filter(CommunityMember.user_id == user.id) if user.ignore_bots == 1: posts = posts.filter(Post.from_bot == False) - if user.show_nsfl == 1: + if user.hide_nsfl == 1: posts = posts.filter(Post.nsfl == False) - if user.show_nsfw == 1: + if user.hide_nsfw == 1: posts = posts.filter(Post.nsfw == False) domains_ids = blocked_domains(user.id) if domains_ids: diff --git a/app/models.py b/app/models.py index 6032d4ea..5fc77836 100644 --- a/app/models.py +++ b/app/models.py @@ -585,8 +585,8 @@ class User(UserMixin, db.Model): about_html = db.Column(db.Text) # html keywords = db.Column(db.String(256)) matrix_user_id = db.Column(db.String(256)) - show_nsfw = db.Column(db.Integer, default=1) - show_nsfl = db.Column(db.Integer, default=1) + hide_nsfw = db.Column(db.Integer, default=1) + hide_nsfl = db.Column(db.Integer, default=1) created = db.Column(db.DateTime, default=utcnow) last_seen = db.Column(db.DateTime, default=utcnow, index=True) avatar_id = db.Column(db.Integer, db.ForeignKey('file.id'), index=True) diff --git a/app/search/routes.py b/app/search/routes.py index 23f27e30..7010f37e 100644 --- a/app/search/routes.py +++ b/app/search/routes.py @@ -32,9 +32,9 @@ def run_search(): if current_user.is_authenticated: if current_user.ignore_bots == 1: posts = posts.filter(Post.from_bot == False) - if current_user.show_nsfl == 1: + if current_user.hide_nsfl == 1: posts = posts.filter(Post.nsfl == False) - if current_user.show_nsfw == 1: + if current_user.hide_nsfw == 1: posts = posts.filter(Post.nsfw == False) domains_ids = blocked_domains(current_user.id) if domains_ids: diff --git a/app/templates/admin/edit_user.html b/app/templates/admin/edit_user.html index e276c43f..1e01e49b 100644 --- a/app/templates/admin/edit_user.html +++ b/app/templates/admin/edit_user.html @@ -27,8 +27,8 @@ {{ render_field(form.verified) }} {{ render_field(form.banned) }}
receive newsletter: {{ user.newsletter }}
- {{ render_field(form.show_nsfw) }} - {{ render_field(form.show_nsfl) }} + {{ render_field(form.hide_nsfw) }} + {{ render_field(form.hide_nsfl) }}searchable: {{ user.searchable }}
indexable: {{ user.indexable }}
{{ render_field(form.role) }} diff --git a/app/templates/user/filters.html b/app/templates/user/filters.html index cb4ae52f..ca881b01 100644 --- a/app/templates/user/filters.html +++ b/app/templates/user/filters.html @@ -22,8 +22,8 @@ {{ form.csrf_token() }}