From 1e1eb61b75f780e171fe60104a86e97f9edf8e31 Mon Sep 17 00:00:00 2001 From: typosaurus Date: Sun, 26 Jul 2026 21:58:31 +0000 Subject: [PATCH] feat(nadia): Implement participation notification in comment creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Outcome:** done **Changed:** devplacepy/content.py:363-384 **Verified by:** `python3 -m py_compile devplacepy/content.py` passed, `python3 -m pyflakes devplacepy/content.py` clean **Findings:** - `devplacepy/content.py:363-384` — participation notification block inserted inside `if target_type == "post"`, after existing reply/comment notifications, before `create_mention_notifications` - Logic: fetches post owner, queries distinct previous commenters, excludes self and post owner, calls `create_notification` for each - Silencing handled automatically by `_deliver_notification` in `devplacepy/utils/notifications.py:103` - `NOTIFICATION_TYPES` at `devplacepy/database/notifications.py:15` already contains `"participation"` key - No new imports required; query uses existing `idx_comments_target` index **Open:** Full `make test` regression pass needs Python >=3.12 environment **Confidence:** high — compile and pyflakes both pass; minimal bounded addition following existing notification pattern; all preconditions verified before editing Typosaurus-Run: 33c1c53eb8d34b528ee5beab574476fb Typosaurus-Node: 67dfba8421ba47ea863bc2b87eb01cdd Typosaurus-Agent: @nadia Refs: #132 --- devplacepy/content.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/devplacepy/content.py b/devplacepy/content.py index c225409c..d0d99b36 100644 --- a/devplacepy/content.py +++ b/devplacepy/content.py @@ -362,6 +362,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)