From cf42c9c50192f8c77998c5f6f1f3ca042d660679 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 29 Jun 2022 01:34:57 +0200 Subject: [PATCH] do this https://chapotraphouse.club/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/2209654?context=8#context --- files/routes/posts.py | 4 ++-- files/routes/subs.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 77671eaa0..d3139ae4e 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -80,7 +80,7 @@ def publish(pid, v): add_notif(cid, user.id) if post.sub: - on_post_hole_entered(post) + on_post_hole_entered(post, v) cache.delete_memoized(frontlist) @@ -1047,7 +1047,7 @@ def submit_post(v, sub=None): add_notif(cid, user.id) if post.sub: - on_post_hole_entered(post) + on_post_hole_entered(post, v) if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{post.body}{post.title}'.lower(): post.is_banned = True diff --git a/files/routes/subs.py b/files/routes/subs.py index 385330c17..e81d24b34 100644 --- a/files/routes/subs.py +++ b/files/routes/subs.py @@ -315,7 +315,7 @@ def kick(v, pid): return {"message": "Post kicked successfully!"} -def on_post_hole_entered(post): +def on_post_hole_entered(post, v): if not post.sub or not post.subr: return hole = post.subr.name @@ -323,9 +323,10 @@ def on_post_hole_entered(post): # Notify hole followers if not post.ghost and not post.private: text = f"/h/{hole} has a new " \ - + f"post: [{post.title}]({post.shortlink})" + + f"post: [{post.title}]({post.shortlink}) by @{v.username}" cid = notif_comment(text, autojanny=True) for follow in post.subr.followers: + if follow.user_id == v.id: continue user = get_account(follow.user_id) if post.club and not user.paid_dues: continue add_notif(cid, user.id)