Revert "remove poor mode"

This reverts commit 33d281cc2e.
pull/158/head
Aevann 2023-06-27 15:01:40 +03:00
parent 87a9a17604
commit 60b5b33a79
9 changed files with 37 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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.

View File

@ -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' %}

View File

@ -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' %}

View File

@ -16,7 +16,7 @@
</div>
<div class="px-3">
<input disabled autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search.." data-nonce="{{g.nonce}}" data-onchange="start_search()" data-oninput="start_search()">
<input disabled autocomplete="off" class="form-control px-2" type="text" id="emoji_search" placeholder="Search.." data-nonce="{{g.nonce}}" data-onchange="start_search()" {% if not (v and v.poor) %}data-oninput="start_search()"{% endif %}>
</div>
<div class="px-3 d-flex flex-row">
<fieldset class="pt-2 pr-2 pl-1">

View File

@ -5,6 +5,31 @@
<div class="col col-lg-8">
<div class="settings">
{# toggle_section(title, id, name, flag, below_text) #}
<section id="site-settings-poorcel-mode-section" class="settings-section-section"> {# note: not using the thing from common just because of how much stuff there is in here #}
<h5>Poor Mode</h5>
<div class="settings-section rounded">
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="poor">Poor Mode</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input setting_switch" data-nonce="{{g.nonce}}" id="poor" name="poor"{% if v.poor %} checked{% endif %}>
<label class="custom-control-label" for="poor"></label>
</div>
<span class="text-small text-muted">Makes the site faster for low-end devices:</span>
<ul>
<li><small>Disables the effects of cosmetic awards.</small></li>
<li><small>Hides signatures.</small></li>
<li><small>Makes emoji search only start when you press Enter.</small></li>
{% if SITE_NAME == 'rDrama' %}
<li><small>Disables event music.</small></li>
{% endif %}
</ul>
</div>
</div>
</div>
</section>
<section id="site-settings-sort-time-filter-section" class="settings-section-section">
<h5>Sorting and Filtering</h5>
<div class="settings-section rounded">