diff --git a/devplacepy/content.py b/devplacepy/content.py index b28891bf..c6ea40e7 100644 --- a/devplacepy/content.py +++ b/devplacepy/content.py @@ -360,6 +360,29 @@ def create_comment_record( comment_url, ) + # Notify previous commenters on this post (participation) + posts = get_table("posts") + post = posts.find_one(uid=target_uid) + if not post: + post = posts.find_one(slug=target_uid) + if post: + post_owner_uid = post["user_uid"] + previous_commenters = set() + for c in get_table("comments").find( + target_type="post", target_uid=target_uid, deleted_at=None + ): + cu = c["user_uid"] + if cu != user["uid"] and cu != post_owner_uid: + previous_commenters.add(cu) + for cu in previous_commenters: + create_notification( + cu, + "participation", + f"{user['username']} also commented on this post", + user["uid"], + comment_url, + ) + create_mention_notifications(content, user["uid"], comment_url) schedule_correction(user, "comments", comment_uid, request) schedule_modification(user, "comments", comment_uid, request) @@ -718,3 +741,4 @@ def enrich_items( ) enriched.append(entry) return enriched +