From 60b5b33a7932e8f4d29ca47364352540cf43566e Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 27 Jun 2023 15:01:40 +0300 Subject: [PATCH] Revert "remove poor mode" This reverts commit 33d281cc2e3b1038284a1cfd0e498f5f511349bb. --- files/classes/comment.py | 1 + files/classes/post.py | 2 ++ files/classes/user.py | 2 +- files/routes/settings.py | 4 ++++ files/routes/wrappers.py | 1 + files/templates/events/DKD/music.html | 2 +- files/templates/events/fistmas/music.html | 2 +- files/templates/modals/emoji.html | 2 +- files/templates/settings/advanced.html | 25 +++++++++++++++++++++++ 9 files changed, 37 insertions(+), 4 deletions(-) diff --git a/files/classes/comment.py b/files/classes/comment.py index 49371871a..aec56587d 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -256,6 +256,7 @@ class Comment(Base): @lazy def award_count(self, kind, v): + if v and v.poor and kind.islower(): return 0 num = len([x for x in self.awards if x.kind == kind]) if kind == 'tilt' and num > 4: return 4 return num diff --git a/files/classes/post.py b/files/classes/post.py index b02c05971..6d3f167ee 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -246,6 +246,8 @@ class Post(Base): def award_count(self, kind, v): if SITE_NAME == 'WPD' and not v and kind in {'confetti', 'fireworks'} and self.sub not in {'meta', 'discussion', 'social', 'music'}: return 0 + elif v and v.poor: + return 0 elif self.distinguish_level: if SITE_NAME == 'rDrama' and kind in {'glowie', 'tilt',}: return 0 diff --git a/files/classes/user.py b/files/classes/user.py index 8bf9f5481..8efcc3c3c 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -1159,7 +1159,7 @@ class User(Base): if not self.patron and SITE_NAME != 'WPD': return False - if v and v.sigs_disabled: + if v and (v.sigs_disabled or v.poor): return False return True diff --git a/files/routes/settings.py b/files/routes/settings.py index 75d56801d..32d509f2e 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -167,6 +167,10 @@ def settings_personal_post(v): if reddit in {'old.reddit.com', 'reddit.com', 'i.reddit.com', 'reddit.lol', 'libredd.it', 'unddit.com'}: updated = True v.reddit = reddit + elif request.values.get("poor", v.poor) != v.poor: + updated = True + v.poor = request.values.get("poor", v.poor) == 'true' + session['poor'] = v.poor slur_filter_updated = updated or update_potentially_permanent_flag("slurreplacer", "slurreplacer", "slur replacer", 192) if isinstance(slur_filter_updated, bool): diff --git a/files/routes/wrappers.py b/files/routes/wrappers.py index 3c139ec16..614d21330 100644 --- a/files/routes/wrappers.py +++ b/files/routes/wrappers.py @@ -63,6 +63,7 @@ def get_logged_in_user(): g.v = v if v: + v.poor = session.get('poor') # Check against last_active + ACTIVE_TIME to reduce frequency of # UPDATEs in exchange for a ±ACTIVE_TIME margin of error. diff --git a/files/templates/events/DKD/music.html b/files/templates/events/DKD/music.html index b397dfc60..e4966a563 100644 --- a/files/templates/events/DKD/music.html +++ b/files/templates/events/DKD/music.html @@ -1,4 +1,4 @@ -{% if not (sub and sub.name == 'music') %} +{% if not (v and v.poor) and not (sub and sub.name == 'music') %} {% if not song %} {% set path = "assets/events/DKD/music" %} {% set song = "/" ~ path ~ "/" ~ listdir('files/' ~ path)|random() ~ '?x=2' %} diff --git a/files/templates/events/fistmas/music.html b/files/templates/events/fistmas/music.html index 8e1739b21..4b6fcc95d 100644 --- a/files/templates/events/fistmas/music.html +++ b/files/templates/events/fistmas/music.html @@ -1,4 +1,4 @@ -{% if not (SITE_NAME == 'WPD' and not v) and (not v or v.event_music) and not (sub and sub.name == 'music') %} +{% if not (SITE_NAME == 'WPD' and not v) and not (v and v.poor) and (not v or v.event_music) and not (sub and sub.name == 'music') %} {% if not song %} {% set path = "assets/events/fistmas/music" %} {% set song = "/" ~ path ~ "/" ~ listdir('files/' ~ path)|random() ~ '?x=2' %} diff --git a/files/templates/modals/emoji.html b/files/templates/modals/emoji.html index dc226ffe4..832e5f42e 100644 --- a/files/templates/modals/emoji.html +++ b/files/templates/modals/emoji.html @@ -16,7 +16,7 @@
- +
diff --git a/files/templates/settings/advanced.html b/files/templates/settings/advanced.html index c99e3692c..c90fc1bb4 100644 --- a/files/templates/settings/advanced.html +++ b/files/templates/settings/advanced.html @@ -5,6 +5,31 @@
{# toggle_section(title, id, name, flag, below_text) #} +
{# note: not using the thing from common just because of how much stuff there is in here #} +
Poor Mode
+
+
+
+ +
+
+
+ + +
+ Makes the site faster for low-end devices: +
    +
  • Disables the effects of cosmetic awards.
  • +
  • Hides signatures.
  • +
  • Makes emoji search only start when you press Enter.
  • + {% if SITE_NAME == 'rDrama' %} +
  • Disables event music.
  • + {% endif %} +
+
+
+
+
Sorting and Filtering