better v.poor code

master
Aevann 2023-08-03 23:26:53 +03:00
parent 4c9858f143
commit 443615e14f
3 changed files with 6 additions and 3 deletions

View File

@ -253,6 +253,11 @@ class User(Base):
return (succeeded, charged_coins)
@property
@lazy
def poor(self):
return session.get('poor')
@property
@lazy
def num_of_bought_awards(self):

View File

@ -138,8 +138,7 @@ def settings_personal_post(v):
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
session['poor'] = request.values.get("poor", v.poor) == 'true'
slur_filter_updated = updated or update_potentially_permanent_flag("slurreplacer", "slurreplacer", "slur replacer", 192)
if isinstance(slur_filter_updated, bool):

View File

@ -108,7 +108,6 @@ 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.