Remove vestigial user ID special cases.
This commit is contained in:
parent
010c56a35e
commit
9de6f20dea
13 changed files with 11 additions and 94 deletions
|
@ -202,7 +202,7 @@ class User(Base):
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def mod_date(self, sub):
|
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()
|
mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none()
|
||||||
if not mod: return None
|
if not mod: return None
|
||||||
return mod.created_utc
|
return mod.created_utc
|
||||||
|
|
|
@ -27,23 +27,8 @@ AUTOBETTER_ID = 7
|
||||||
AUTOCHOICE_ID = 8
|
AUTOCHOICE_ID = 8
|
||||||
BASEDBOT_ID = 0
|
BASEDBOT_ID = 0
|
||||||
|
|
||||||
A_ID = 0
|
|
||||||
KIPPY_ID = 0
|
|
||||||
GIFT_NOTIF_ID = 9
|
GIFT_NOTIF_ID = 9
|
||||||
PIZZASHILL_ID = 0
|
OWNER_ID = 9
|
||||||
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
|
|
||||||
BUG_THREAD = 0
|
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."
|
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={}
|
ROLES={}
|
||||||
|
@ -397,34 +382,11 @@ for k, val in AWARDS2.items():
|
||||||
if val['price'] == 300: AWARDS3[k] = val
|
if val['price'] == 300: AWARDS3[k] = val
|
||||||
|
|
||||||
NOTIFIED_USERS = {
|
NOTIFIED_USERS = {
|
||||||
'aevan': AEVANN_ID,
|
# format: 'substring' ↦ User ID to notify
|
||||||
'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,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patron = 'Patron'
|
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 = {
|
discounts = {
|
||||||
69: 0.02,
|
69: 0.02,
|
||||||
70: 0.04,
|
70: 0.04,
|
||||||
|
|
|
@ -61,8 +61,6 @@ def inject_constants():
|
||||||
"CC":CC,
|
"CC":CC,
|
||||||
"CC_TITLE":CC_TITLE,
|
"CC_TITLE":CC_TITLE,
|
||||||
"listdir":listdir,
|
"listdir":listdir,
|
||||||
"AEVANN_ID":AEVANN_ID,
|
|
||||||
"PIZZASHILL_ID":PIZZASHILL_ID,
|
|
||||||
"config":app.config.get,
|
"config":app.config.get,
|
||||||
"DEFAULT_COLOR":DEFAULT_COLOR,
|
"DEFAULT_COLOR":DEFAULT_COLOR,
|
||||||
"COLORS":COLORS,
|
"COLORS":COLORS,
|
||||||
|
|
|
@ -26,7 +26,7 @@ month = datetime.now().strftime('%B')
|
||||||
@limiter.exempt
|
@limiter.exempt
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
def merge(v, id1, id2):
|
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:
|
if time.time() - session.get('verified', 0) > 3:
|
||||||
session.pop("session_id", None)
|
session.pop("session_id", None)
|
||||||
|
@ -87,7 +87,7 @@ def merge(v, id1, id2):
|
||||||
@limiter.exempt
|
@limiter.exempt
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
def merge_all(v, id):
|
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:
|
if time.time() - session.get('verified', 0) > 3:
|
||||||
session.pop("session_id", None)
|
session.pop("session_id", None)
|
||||||
|
@ -650,7 +650,7 @@ def badge_grant_post(v):
|
||||||
try: badge_id = int(request.values.get("badge_id"))
|
try: badge_id = int(request.values.get("badge_id"))
|
||||||
except: abort(400)
|
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)
|
abort(403)
|
||||||
|
|
||||||
if user.has_badge(badge_id):
|
if user.has_badge(badge_id):
|
||||||
|
|
|
@ -115,10 +115,6 @@ def buy(v, award):
|
||||||
g.db.add(award_object)
|
g.db.add(award_object)
|
||||||
|
|
||||||
g.db.add(v)
|
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()
|
g.db.commit()
|
||||||
|
|
||||||
return {"message": "Award bought!"}
|
return {"message": "Award bought!"}
|
||||||
|
@ -158,9 +154,6 @@ def award_post(pid, v):
|
||||||
|
|
||||||
author = post.author
|
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:
|
if kind == "benefactor" and author.id == v.id:
|
||||||
return {"error": "You can't use this award on yourself."}, 400
|
return {"error": "You can't use this award on yourself."}, 400
|
||||||
|
|
||||||
|
@ -387,9 +380,6 @@ def award_comment(cid, v):
|
||||||
|
|
||||||
author = c.author
|
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 v.id != author.id:
|
||||||
if author.deflector and AWARDS[kind]['price'] > 300 and kind not in ('pin','unpin','benefactor'):
|
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:"
|
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:"
|
||||||
|
|
|
@ -323,16 +323,6 @@ def api_comment(v):
|
||||||
g.db.add(vote)
|
g.db.add(vote)
|
||||||
|
|
||||||
c.voted = 1
|
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):
|
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
|
return {"error":"You can only type marseys!"}, 403
|
||||||
|
|
|
@ -31,7 +31,6 @@ def check_for_alts(current_id):
|
||||||
past_accs.remove(past_id)
|
past_accs.remove(past_id)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if past_id == MOM_ID or current_id == MOM_ID: break
|
|
||||||
if past_id == current_id: continue
|
if past_id == current_id: continue
|
||||||
|
|
||||||
li = [past_id, current_id]
|
li = [past_id, current_id]
|
||||||
|
@ -144,7 +143,8 @@ def login_post():
|
||||||
session["session_id"] = token_hex(49)
|
session["session_id"] = token_hex(49)
|
||||||
session["lo_user"] = account.id
|
session["lo_user"] = account.id
|
||||||
session["login_nonce"] = account.login_nonce
|
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)
|
check_for_alts(account.id)
|
||||||
|
|
||||||
|
|
|
@ -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()
|
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)
|
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()
|
g.db.commit()
|
||||||
|
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
|
|
|
@ -261,10 +261,6 @@ def settings_profile_post(v):
|
||||||
|
|
||||||
if house == "None": house = None
|
if house == "None": house = None
|
||||||
v.house = house
|
v.house = house
|
||||||
|
|
||||||
if v.house == "Vampire":
|
|
||||||
send_repeatable_notification(DAD_ID, f"@{v.username} has joined House Vampire!")
|
|
||||||
|
|
||||||
updated = True
|
updated = True
|
||||||
|
|
||||||
if updated:
|
if updated:
|
||||||
|
|
|
@ -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}"}
|
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)
|
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()
|
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())
|
if view: view.last_view_utc = int(time.time())
|
||||||
|
|
|
@ -19,7 +19,7 @@ def admin_vote_info_get(v):
|
||||||
else: abort(400)
|
else: abort(400)
|
||||||
except: 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:
|
if not thing.author:
|
||||||
print(thing.id, flush=True)
|
print(thing.id, flush=True)
|
||||||
|
|
|
@ -2,14 +2,6 @@
|
||||||
|
|
||||||
{% block desktopBanner %}
|
{% 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 v and environ.get("FP") %}
|
||||||
{% if not v.fp %}
|
{% if not v.fp %}
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
|
|
||||||
<div class="post-meta text-left mb-md-2">
|
<div class="post-meta text-left mb-md-2">
|
||||||
<h5 class="card-title post-title text-left mb-0 pb-0 pb-md-1">
|
<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.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 %}
|
{% 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}}
|
{{p.realtitle(v) | safe}}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue