From f872f734ece7b7bfbcf1707541ae48f4d1dd0938 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Sun, 9 Oct 2022 23:37:42 -0700 Subject: [PATCH] constantify a bunch of things * sign up follow id is now a thing (if not specified will just msg carp instead) * notification thread id is also a constant now * blackjackbtz id is a constant, used for i think special PM handling --- files/helpers/const.py | 10 +++++++++- files/routes/comments.py | 4 +--- files/routes/login.py | 23 ++++++++--------------- files/routes/users.py | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index a6f999e07..881b6c848 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -307,6 +307,7 @@ DAD_ID = 0 MOM_ID = 0 DONGER_ID = 0 GEESE_ID = 0 +BLACKJACKBTZ_ID = 0 POLL_THREAD = 0 POLL_BET_COINS = 200 @@ -323,6 +324,8 @@ BANNER_THREAD = 0 BADGE_THREAD = 0 SNAPPY_THREAD = 0 GIFT_NOTIF_ID = 5 +SIGNUP_FOLLOW_ID = 0 +NOTIFICATION_THREAD = 1 if SITE == 'rdrama.net': FEATURES['PRONOUNS'] = True @@ -333,6 +336,7 @@ if SITE == 'rdrama.net': BANNER_THREAD = 37697 BADGE_THREAD = 37833 SNAPPY_THREAD = 37749 + NOTIFICATION_THREAD = 6489 HOLE_COST = 50000 HOLE_INACTIVITY_DELETION = True @@ -363,6 +367,7 @@ if SITE == 'rdrama.net': MOM_ID = 4588 DONGER_ID = 541 GEESE_ID = 1710 + BLACKJACKBTZ_ID = 12732 GIFT_NOTIF_ID = CARP_ID @@ -395,7 +400,9 @@ elif SITE == 'pcmemes.net': BASEDBOT_ID = 800 KIPPY_ID = 1592 - GIFT_NOTIF_ID = 1592 + GIFT_NOTIF_ID = KIPPY_ID + SIGNUP_FOLLOW_ID = KIPPY_ID + NOTIFICATION_THREAD = 2487 CARP_ID = 13 AEVANN_ID = 1 SNAKES_ID = 2279 @@ -431,6 +438,7 @@ elif SITE == 'watchpeopledie.co': SNAKES_ID = 32 GIFT_NOTIF_ID = CARP_ID + SIGNUP_FOLLOW_ID = CARP_ID else: # localhost or testing environment implied FEATURES['PRONOUNS'] = True diff --git a/files/routes/comments.py b/files/routes/comments.py index fbfceba30..2229208cb 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -51,9 +51,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): if not pid: if comment.parent_submission: pid = comment.parent_submission - elif SITE_NAME == 'rDrama': pid = 6489 - elif SITE == 'pcmemes.net': pid = 2487 - else: pid = 1 + else: pid = NOTIFICATION_THREAD post = get_post(pid, v=v) diff --git a/files/routes/login.py b/files/routes/login.py index 3d6f9da0e..0c764e7f5 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -374,22 +374,15 @@ def sign_up_post(v): session["lo_user"] = new_user.id - if SITE == 'rdrama.net': + if SIGNUP_FOLLOW_ID: + signup_autofollow = get_account(SIGNUP_FOLLOW_ID) + new_follow = Follow(user_id=new_user.id, target_id=signup_autofollow.id) + g.db.add(new_follow) + signup_autofollow.stored_subscriber_count += 1 + g.db.add(signup_autofollow) + send_notification(signup_autofollow.id, f"A new user - @{new_user.username} - has followed you automatically!") + elif CARP_ID: send_notification(CARP_ID, f"A new user - @{new_user.username} - has signed up!") - if SITE == 'watchpeopledie.co': - carp = get_account(CARP_ID) - new_follow = Follow(user_id=new_user.id, target_id=carp.id) - g.db.add(new_follow) - carp.stored_subscriber_count += 1 - g.db.add(carp) - send_notification(carp.id, f"A new user - @{new_user.username} - has followed you automatically!") - if SITE == 'pcmemes.net': - kippy = get_account(KIPPY_ID) - new_follow = Follow(user_id=new_user.id, target_id=kippy.id) - g.db.add(new_follow) - kippy.stored_subscriber_count += 1 - g.db.add(kippy) - send_notification(kippy.id, f"A new user - @{new_user.username} - has followed you automatically!") redir = request.values.get("redirect") if redir: diff --git a/files/routes/users.py b/files/routes/users.py index fa667a02a..830cc17b8 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -506,7 +506,7 @@ def message2(v, username): body_html = sanitize(message) - if not (SITE == 'rdrama.net' and user.id == 12732): + if not (SITE == 'rdrama.net' and user.id == BLACKJACKBTZ_ID): existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, Comment.sentto == user.id, Comment.body_html == body_html,