Remove vestigial user ID special cases.

This commit is contained in:
TLSM 2022-11-06 17:17:23 -05:00 committed by Ben Rog-Wilhelm
parent 010c56a35e
commit 9de6f20dea
13 changed files with 11 additions and 94 deletions

View file

@ -202,7 +202,7 @@ class User(Base):
@lazy
def mod_date(self, sub):
if self.id == AEVANN_ID: return 1
if self.id == OWNER_ID: return 1
mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none()
if not mod: return None
return mod.created_utc

View file

@ -27,23 +27,8 @@ AUTOBETTER_ID = 7
AUTOCHOICE_ID = 8
BASEDBOT_ID = 0
A_ID = 0
KIPPY_ID = 0
GIFT_NOTIF_ID = 9
PIZZASHILL_ID = 0
PIZZA_VOTERS = ()
IDIO_ID = 0
CARP_ID = 0
JOAN_ID = 0
AEVANN_ID = 9
HOMO_ID = 0
SOREN_ID = 0
Q_ID = 0
LAWLZ_ID = 0
LLM_ID = 0
DAD_ID = 0
MOM_ID = 0
DONGER_ID = 0
OWNER_ID = 9
BUG_THREAD = 0
WELCOME_MSG = f"Welcome to {SITE_TITLE}! Please read [the rules](/rules) first. Then [read some of our current conversations](/) and feel free to comment or post!\n\nWe encourage people to comment even if they aren't sure they fit in; as long as your comment follows [community rules](/rules), we are happy to have posters from all backgrounds, education levels, and specialties."
ROLES={}
@ -397,34 +382,11 @@ for k, val in AWARDS2.items():
if val['price'] == 300: AWARDS3[k] = val
NOTIFIED_USERS = {
'aevan': AEVANN_ID,
'avean': AEVANN_ID,
'joan': JOAN_ID,
'pewkie': JOAN_ID,
'carp': CARP_ID,
'idio3': IDIO_ID,
'idio ': IDIO_ID,
'landlord_messiah': LLM_ID,
'landlordmessiah': LLM_ID,
' llm ': LLM_ID,
'landlet': LLM_ID,
'dong': DONGER_ID,
'kippy': KIPPY_ID,
'the_homocracy': HOMO_ID,
'soren': SOREN_ID,
# format: 'substring' ↦ User ID to notify
}
patron = 'Patron'
REDDIT_NOTIFS = {
'idio3': IDIO_ID,
'aevann': AEVANN_ID,
'carpflo': CARP_ID,
'carpathianflorist': CARP_ID,
'carpathian florist': CARP_ID,
'the_homocracy': HOMO_ID
}
discounts = {
69: 0.02,
70: 0.04,

View file

@ -61,8 +61,6 @@ def inject_constants():
"CC":CC,
"CC_TITLE":CC_TITLE,
"listdir":listdir,
"AEVANN_ID":AEVANN_ID,
"PIZZASHILL_ID":PIZZASHILL_ID,
"config":app.config.get,
"DEFAULT_COLOR":DEFAULT_COLOR,
"COLORS":COLORS,

View file

@ -26,7 +26,7 @@ month = datetime.now().strftime('%B')
@limiter.exempt
@admin_level_required(3)
def merge(v, id1, id2):
if v.id != AEVANN_ID: abort(403)
if v.id != OWNER_ID: abort(403)
if time.time() - session.get('verified', 0) > 3:
session.pop("session_id", None)
@ -87,7 +87,7 @@ def merge(v, id1, id2):
@limiter.exempt
@admin_level_required(3)
def merge_all(v, id):
if v.id != AEVANN_ID: abort(403)
if v.id != OWNER_ID: abort(403)
if time.time() - session.get('verified', 0) > 3:
session.pop("session_id", None)
@ -650,7 +650,7 @@ def badge_grant_post(v):
try: badge_id = int(request.values.get("badge_id"))
except: abort(400)
if badge_id in {16,17,94,95,96,97,98,109} and v.id != AEVANN_ID:
if badge_id in {16,17,94,95,96,97,98,109} and v.id != OWNER_ID:
abort(403)
if user.has_badge(badge_id):

View file

@ -115,10 +115,6 @@ def buy(v, award):
g.db.add(award_object)
g.db.add(v)
if CARP_ID and v.id != CARP_ID and og_price >= 10000:
send_repeatable_notification(CARP_ID, f"@{v.username} has bought a `{award}` award!")
g.db.commit()
return {"message": "Award bought!"}
@ -158,9 +154,6 @@ def award_post(pid, v):
author = post.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
@ -387,9 +380,6 @@ def award_comment(cid, v):
author = c.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if v.id != author.id:
if author.deflector and AWARDS[kind]['price'] > 300 and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"

View file

@ -323,16 +323,6 @@ def api_comment(v):
g.db.add(vote)
c.voted = 1
if v.id == PIZZASHILL_ID:
for uid in PIZZA_VOTERS:
autovote = CommentVote(user_id=uid, comment_id=c.id, vote_type=1)
g.db.add(autovote)
v.coins += 3
v.truecoins += 3
g.db.add(v)
c.upvotes += 3
g.db.add(c)
if v.marseyawarded and parent_post.id not in ADMINISTRATORS and marseyaward_body_regex.search(body_html):
return {"error":"You can only type marseys!"}, 403

View file

@ -31,7 +31,6 @@ def check_for_alts(current_id):
past_accs.remove(past_id)
continue
if past_id == MOM_ID or current_id == MOM_ID: break
if past_id == current_id: continue
li = [past_id, current_id]
@ -144,7 +143,8 @@ def login_post():
session["session_id"] = token_hex(49)
session["lo_user"] = account.id
session["login_nonce"] = account.login_nonce
if account.id == AEVANN_ID: session["verified"] = time.time()
if account.id == OWNER_ID:
session["verified"] = time.time()
check_for_alts(account.id)

View file

@ -1007,17 +1007,6 @@ def submit_post(v, sub=None):
v.post_count = g.db.query(Submission.id).filter_by(author_id=v.id, is_banned=False, deleted_utc=0).count()
g.db.add(v)
if v.id == PIZZASHILL_ID:
for uid in PIZZA_VOTERS:
autovote = Vote(user_id=uid, submission_id=post.id, vote_type=1)
g.db.add(autovote)
v.coins += 3
v.truecoins += 3
g.db.add(v)
post.upvotes += 3
g.db.add(post)
g.db.commit()
cache.delete_memoized(frontlist)

View file

@ -261,10 +261,6 @@ def settings_profile_post(v):
if house == "None": house = None
v.house = house
if v.house == "Vampire":
send_repeatable_notification(DAD_ID, f"@{v.username} has joined House Vampire!")
updated = True
if updated:

View file

@ -799,7 +799,7 @@ def u_username(username, v=None):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"}
return render_template("userpage_reserved.html", u=u, v=v)
if v and v.id not in (u.id,DAD_ID) and (u.patron or u.admin_level > 1):
if v and v.id != u.id and (u.patron or u.admin_level > 1):
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
if view: view.last_view_utc = int(time.time())

View file

@ -19,7 +19,7 @@ def admin_vote_info_get(v):
else: abort(400)
except: abort(400)
if thing.ghost and v.id != AEVANN_ID: abort(403)
if thing.ghost and v.id != OWNER_ID: abort(403)
if not thing.author:
print(thing.id, flush=True)

View file

@ -2,14 +2,6 @@
{% block desktopBanner %}
{% if v and v.id == AEVANN_ID %}
<style>
#frontpage .post-title a:not(.visited):visited {
color: var(--black) !important;
}
</style>
{% endif %}
{% if v and environ.get("FP") %}
{% if not v.fp %}
<script>

View file

@ -147,7 +147,7 @@
<div class="post-meta text-left mb-md-2">
<h5 class="card-title post-title text-left mb-0 pb-0 pb-md-1">
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if voted and v.id == AEVANN_ID %}visited{% endif %}">
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}