From 9559c6e93aadb4cd99d222b14f83ccfc1e37de9e Mon Sep 17 00:00:00 2001 From: Aevann Date: Mon, 27 Feb 2023 15:35:53 +0200 Subject: [PATCH] hide ghosts in push notifs --- files/helpers/actions.py | 4 ++-- files/routes/comments.py | 6 +++--- files/routes/static.py | 2 +- files/routes/users.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index 96cc3b954..d3fd81962 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -262,7 +262,7 @@ def execute_zozbot(c:Comment, level:int, post_target:post_target_type, v): post_target.comment_count += 3 g.db.add(post_target) - push_notif({v.id}, 'New reply by @zozbot', "zoz", c2) + push_notif({v.id}, f'New reply by @{c2.author_name}', "zoz", c2) def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_target_type, v:User): if SITE_NAME != 'rDrama': return @@ -308,7 +308,7 @@ def execute_longpostbot(c:Comment, level:int, body, body_html, post_target:post_ post_target.comment_count += 3 g.db.add(post_target) - push_notif({v.id}, 'New reply by @longpostbot', c2.body, c2) + push_notif({v.id}, f'New reply by @{c2.author_name}', c2.body, c2) def execute_antispam_submission_check(title, v, url): now = int(time.time()) diff --git a/files/routes/comments.py b/files/routes/comments.py index f909d4fac..2933be7ac 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -310,14 +310,14 @@ def comment(v:User): if not v.shadowbanned: notify_users = NOTIFY_USERS(body, v) - push_notif(notify_users, f'New mention of you by @{v.username}', c.body, c) + push_notif(notify_users, f'New mention of you by @{c.author_name}', c.body, c) if c.level == 1 and posting_to_submission: subscriber_ids = [x[0] for x in g.db.query(Subscription.user_id).filter(Subscription.submission_id == post_target.id, Subscription.user_id != v.id).all()] notify_users.update(subscriber_ids) - push_notif(subscriber_ids, f'New comment in subscribed thread by @{v.username}', c.body, c) + push_notif(subscriber_ids, f'New comment in subscribed thread by @{c.author_name}', c.body, c) if parent_user.id != v.id: notify_users.add(parent_user.id) @@ -448,7 +448,7 @@ def edit_comment(cid, v): n = Notification(comment_id=c.id, user_id=x) g.db.add(n) if not v.shadowbanned: - push_notif({x}, f'New mention of you by @{v.username}', c.body, c) + push_notif({x}, f'New mention of you by @{c.author_name}', c.body, c) g.db.commit() return {"body": c.body, "comment": c.realbody(v)} diff --git a/files/routes/static.py b/files/routes/static.py index 51b34a262..6177d49cf 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -280,7 +280,7 @@ def submit_contact(v): notif = Notification(comment_id=new_comment.id, user_id=admin_id) g.db.add(notif) - push_notif(admin_ids, f'New modmail from @{v.username}', new_comment.body, f'{SITE_FULL}/notifications/modmail') + push_notif(admin_ids, f'New modmail from @{new_comment.author_name}', new_comment.body, f'{SITE_FULL}/notifications/modmail') return redirect("/contact?msg=Your message has been sent to the admins!") diff --git a/files/routes/users.py b/files/routes/users.py index b7d9ca4a0..b0a951b43 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -553,7 +553,7 @@ def message2(v:User, username:str): if not v.shadowbanned: - title = f'New message from @{v.username}' + title = f'New message from @{c.author_name}' url = f'{SITE_FULL}/notifications/messages' @@ -619,7 +619,7 @@ def messagereply(v:User): g.db.add(notif) if not v.shadowbanned: - title = f'New message from @{v.username}' + title = f'New message from @{c.author_name}' url = f'{SITE_FULL}/notifications/messages'