From 778f4f045e151c00c20642d735c0c43b12eff82c Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 29 Jun 2023 22:51:32 +0300 Subject: [PATCH] rename variable --- files/classes/user.py | 8 ++++---- files/routes/admin.py | 2 +- files/routes/comments.py | 2 +- files/routes/posts.py | 4 ++-- files/routes/users.py | 2 +- files/routes/wrappers.py | 2 +- files/templates/admin/alts.html | 2 +- files/templates/comments.html | 4 ++-- files/templates/post_actions.html | 2 +- files/templates/post_admin_actions_mobile.html | 2 +- files/templates/userpage/admintools.html | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index c1c86eac6..2310012b6 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -374,14 +374,14 @@ class User(Base): @lazy def is_votes_real(self): if self.patron: return True - if self.is_suspended_permanently or self.shadowbanned: return False + if self.is_permabanned or self.shadowbanned: return False if self.chud: return False if self.profile_url.startswith('/e/') and not self.customtitle and self.namecolor == DEFAULT_COLOR: return False return True @lazy def mods(self, sub): - if self.is_suspended_permanently or self.shadowbanned: return False + if self.is_permabanned or self.shadowbanned: return False if self.admin_level >= PERMS['MODS_EVERY_HOLE']: return True try: return any(map(lambda x: x.sub == sub, self.sub_mods)) @@ -965,7 +965,7 @@ class User(Base): @property @lazy - def is_suspended_permanently(self): + def is_permabanned(self): return (self.is_banned and self.unban_utc == 0) @property @@ -1116,7 +1116,7 @@ class User(Base): if self.client: return False if self.blacklisted_by: return False if self.shadowbanned: return False - if self.is_suspended_permanently: return False + if self.is_permabanned: return False if self.admin_level >= PERMS['VIEW_RESTRICTED_HOLES']: return True if self.truescore >= TRUESCORE_RESTRICTED_HOLES_MINIMUM: return True diff --git a/files/routes/admin.py b/files/routes/admin.py index fe7f43758..49d67e5ea 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -969,7 +969,7 @@ def ban_user(id, v): if user.admin_level > v.admin_level: abort(403) - if user.is_suspended_permanently: + if user.is_permabanned: abort(403, f"@{user.username} is already banned permanently!") days = 0.0 diff --git a/files/routes/comments.py b/files/routes/comments.py index 5bf7070e0..d3f6040a2 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -573,7 +573,7 @@ def toggle_comment_nsfw(cid, v): if comment.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (comment.post.sub and v.mods(comment.post.sub)): abort(403) - if comment.over_18 and v.is_suspended_permanently: + if comment.over_18 and v.is_permabanned: abort(403) comment.over_18 = not comment.over_18 diff --git a/files/routes/posts.py b/files/routes/posts.py index 9f1b8065f..522dadcbc 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -807,7 +807,7 @@ def mark_post_nsfw(pid, v): if p.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (p.sub and v.mods(p.sub)): abort(403) - if p.over_18 and v.is_suspended_permanently: + if p.over_18 and v.is_permabanned: abort(403) p.over_18 = True @@ -846,7 +846,7 @@ def unmark_post_nsfw(pid, v): if p.author_id != v.id and not v.admin_level >= PERMS['POST_COMMENT_MODERATION'] and not (p.sub and v.mods(p.sub)): abort(403) - if p.over_18 and v.is_suspended_permanently: + if p.over_18 and v.is_permabanned: abort(403) p.over_18 = False diff --git a/files/routes/users.py b/files/routes/users.py index 6c02bfc5d..ac4d9b8dc 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -603,7 +603,7 @@ def messagereply(v:User): parent = get_comment(id, v=v) user_id = parent.author.id - if v.is_suspended_permanently and parent.sentto != MODMAIL_ID: + if v.is_permabanned and parent.sentto != MODMAIL_ID: abort(403, "You are permabanned and may not reply to messages!") elif v.is_muted and parent.sentto == MODMAIL_ID: abort(403, "You are forbidden from replying to modmail!") diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index 36dd7897b..5bd54e364 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -157,7 +157,7 @@ def is_not_permabanned(f): def wrapper(*args, **kwargs): v = get_logged_in_user() if not v: abort(401) - if v.is_suspended_permanently: abort(403) + if v.is_permabanned: abort(403) return make_response(f(*args, v=v, **kwargs)) wrapper.__name__ = f.__name__ return wrapper diff --git a/files/templates/admin/alts.html b/files/templates/admin/alts.html index 0887fc4e2..a21d2496a 100644 --- a/files/templates/admin/alts.html +++ b/files/templates/admin/alts.html @@ -17,7 +17,7 @@ {% set count=alts|length %}

@{{u.username}} created their account {{u.created_utc|timestamp}} and has {{count}} known alt{{macros.plural(count)}}.
- They are {% if not u.is_suspended_permanently %}not {% endif %}permanently banned{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %} and they are {% if not u.shadowbanned %}not {% endif %}shadowbanned{% endif %}.

+ They are {% if not u.is_permabanned %}not {% endif %}permanently banned{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %} and they are {% if not u.shadowbanned %}not {% endif %}shadowbanned{% endif %}.

diff --git a/files/templates/comments.html b/files/templates/comments.html index 0a38bb9c2..9e367616a 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -474,7 +474,7 @@ {% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %} - + {% endif %} {% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %} @@ -687,7 +687,7 @@ {% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %} - + {% endif %} {% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %} diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index 5ab554f51..ff29fd89f 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -87,7 +87,7 @@ {% endif %} {% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %} - + {% endif %} diff --git a/files/templates/post_admin_actions_mobile.html b/files/templates/post_admin_actions_mobile.html index 26054a460..0a9f976a0 100644 --- a/files/templates/post_admin_actions_mobile.html +++ b/files/templates/post_admin_actions_mobile.html @@ -43,7 +43,7 @@ {% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %} - + {% endif %} {% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %} diff --git a/files/templates/userpage/admintools.html b/files/templates/userpage/admintools.html index ea89df162..8918004b2 100644 --- a/files/templates/userpage/admintools.html +++ b/files/templates/userpage/admintools.html @@ -44,7 +44,7 @@ {% if v.admin_level >= PERMS['USER_BAN'] %} - +