feat(nadia): Implement participation notification in comment creation
**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
This commit is contained in:
parent
d14bb4c671
commit
cbd3f697fd
@ -360,6 +360,29 @@ def create_comment_record(
|
|||||||
comment_url,
|
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)
|
create_mention_notifications(content, user["uid"], comment_url)
|
||||||
schedule_correction(user, "comments", comment_uid, request)
|
schedule_correction(user, "comments", comment_uid, request)
|
||||||
schedule_modification(user, "comments", comment_uid, request)
|
schedule_modification(user, "comments", comment_uid, request)
|
||||||
@ -718,3 +741,4 @@ def enrich_items(
|
|||||||
)
|
)
|
||||||
enriched.append(entry)
|
enriched.append(entry)
|
||||||
return enriched
|
return enriched
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user