refactor sigs

remotes/1693045480750635534/spooky-22
Aevann1 2022-09-19 19:51:40 +02:00
parent bb28d2d2a3
commit f7727f1029
6 changed files with 17 additions and 7 deletions

View File

@ -383,7 +383,7 @@ class Comment(Base):
body += f'''><label class="custom-control-label" for="comment-{o.id}">{o.body_html} -
<a href="/votes/comment/option/{o.id}"><span id="score-comment-{o.id}">{o.upvotes}</span> votes</a></label></div>'''
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)))):
if not self.ghost and self.author.show_sig(v):
body += f"<hr>{self.author.sig_html}"
return body

View File

@ -396,8 +396,7 @@ class Submission(Base):
<a href="/votes/post/option/{o.id}"><span id="score-post-{o.id}">{o.upvotes}</span> votes</a></label></div>'''
if not listing and self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and (v.sigs_disabled or v.poor)))):
if not listing and not self.ghost and self.author.show_sig(v):
body += f"<hr>{self.author.sig_html}"
return body

View File

@ -935,3 +935,16 @@ class User(Base):
from_casino_value = from_casino or 0
return from_casino_value + self.total_lottery_winnings
@lazy
def show_sig(self, v):
if not self.author.sig_html:
return False
if not self.author.patron and SITE_NAME != 'WPD':
return False
if v and (v.sigs_disabled or v.poor):
return False
return True

View File

@ -188,7 +188,6 @@ PIZZA_VOTERS = ()
IDIO_ID = 0
CARP_ID = 0
JOAN_ID = 0
MOOSE_ID = 0
AEVANN_ID = 0
SNAKES_ID = 0
HOMO_ID = 0
@ -242,7 +241,6 @@ if SITE == 'rdrama.net':
IDIO_ID = 30
CARP_ID = 995
JOAN_ID = 28
MOOSE_ID = 1904
AEVANN_ID = 1
SNAKES_ID = 10288
HOMO_ID = 147

View File

@ -51,7 +51,7 @@ def timestamp(timestamp):
def inject_constants():
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL,
"AUTOJANNY_ID":AUTOJANNY_ID, "PUSHER_ID":PUSHER_ID,
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID,
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "AEVANN_ID":AEVANN_ID,
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
"COLORS":COLORS, "time":time, "PERMS":PERMS, "FEATURES":FEATURES,
"HOLE_NAME":HOLE_NAME, "HOLE_STYLE_FLAIR":HOLE_STYLE_FLAIR, "HOLE_REQUIRED":HOLE_REQUIRED,

View File

@ -129,7 +129,7 @@ def settings_profile_post(v):
g.db.add(v)
return render_template("settings_profile.html", v=v, msg="Your enemies list has been updated.")
elif (v.patron or v.id == MOOSE_ID) and request.values.get("sig"):
elif v.patron and request.values.get("sig"):
sig = request.values.get("sig")[:200].replace('\n','').replace('\r','')
sig_html = sanitize(sig)