From 52a8a219aed4313c32750c78443ae5979809cf93 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 27 Jun 2022 05:46:32 +0200 Subject: [PATCH] make poorcel-mode device-specific --- files/classes/comment.py | 4 ++-- files/classes/submission.py | 4 ++-- files/helpers/wrappers.py | 2 ++ files/routes/settings.py | 3 ++- files/templates/emoji_modal.html | 2 +- files/templates/header.html | 2 +- files/templates/settings_filters.html | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 06f7ef230..85577933a 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -328,7 +328,7 @@ class Comment(Base): @lazy def award_count(self, kind, v): - if v and v.poorcel: return 0 + if v and v.poor: return 0 return len([x for x in self.awards if x.kind == kind]) @property @@ -436,7 +436,7 @@ class Comment(Base): if not self.total_choice_voted(v): body += ' d-none' body += f'"> - {c.upvotes} votes' - if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poorcel)))): + if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poor)))): body += f"
{self.author.sig_html}" return body diff --git a/files/classes/submission.py b/files/classes/submission.py index ff16b142b..f0bb17e89 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -367,7 +367,7 @@ class Submission(Base): @lazy def award_count(self, kind, v): - if v and v.poorcel: return 0 + if v and v.poor: return 0 return len([x for x in self.awards if x.kind == kind]) @lazy @@ -444,7 +444,7 @@ class Submission(Base): body += "" - if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poorcel)))): + if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poor)))): body += f"
{self.author.sig_html}" return body diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 1042a974a..07857b7ba 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -72,6 +72,8 @@ def get_logged_in_user(): g.v = v + if v: v.poor = session.get('poor') + return v def check_ban_evade(v): diff --git a/files/routes/settings.py b/files/routes/settings.py index 7db501463..15dd08920 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -61,9 +61,10 @@ def settings_profile_post(v): updated = True v.slurreplacer = request.values.get("slurreplacer") == 'true' - elif request.values.get("poorcel", v.poorcel) != v.poorcel: + elif request.values.get("poorcel", v.poor) != v.poor: updated = True v.poorcel = request.values.get("poorcel") == 'true' + session['poor'] = v.poorcel elif request.values.get("hidevotedon", v.hidevotedon) != v.hidevotedon: updated = True diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index 197f86d74..cd86e553a 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -36,7 +36,7 @@
- +
diff --git a/files/templates/header.html b/files/templates/header.html index 82f8ab0d3..3447e007c 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -303,7 +303,7 @@ {% endif %} -{% if v and v.poorcel -%} +{% if v and v.poor -%}