feat(threads): thread following / subscribe (LC-310) #332
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/lc-310-thread-following"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Follow a thread to be notified of every new reply, even without an @mention. A Follow/Following toggle in the thread panel header; replying auto-follows the replier, and the thread root's author is auto-followed.
Approach
Follower notifications reuse the mention fan-out (
fanout_mention_events): on a new reply, each follower (minus the author, minus anyone who lost room access) gets akind="thread"WS toast + push + email, all honoring prefs + per-room mute. Follows are NOTmentionsrows - a follow is not a per-message mention, and routing throughreconcile_mentionswould fight the edit path (which deletes follower rows). A standalonechat.dbthread_followerstable keyed by the thread root, FKON DELETE CASCADE.Changes
migrations/chat/0060_thread_followers.sql+db/thread_followers.rs(follow/unfollow/is_following/followers).routes/room.rs:post_thread_replyauto-follows replier + root author and callsnotify_thread_followers; newpost_thread_follow/delete_thread_followhandlers;get_thread_panelloadsis_following.views/room.rs:ThreadPanelFragment.is_following+ThreadFollowFragment.partials/thread_follow_button.html+ thread-panel header inclusion.routes/mod.rs:POST/DELETE /room/{id}/thread/{parent_id}/follow.layout.html: notify-busthreadtitle branch ("{author} replied in {room}").locales/{en,es}/room.ftl: follow/following strings.Testing
just check,just fmt,just test,just test-saasall pass.db_thread_followers.rs(follow/unfollow/idempotent/followers + FK cascade on root delete) androutes_thread_follow.rs(reply auto-follows replier + root author; follow/unfollow endpoints flip state; non-participant not followed).Not operator-visible (no env/config/contract change).
Follow a thread to be notified of every new reply, even without an @mention. A Follow/Following toggle in the thread panel header subscribes/unsubscribes; replying auto-follows the replier, and the thread root's author is auto-followed so they hear about replies to their message. Follower notifications reuse the mention fan-out (fanout_mention_events): on a new reply, each follower (minus the author, and minus anyone who lost room access) gets a kind="thread" WS toast + push + email, all honoring the recipient's prefs and per-room mute. Follows are deliberately NOT mentions rows - a follow is not a per-message mention, and routing it through reconcile_mentions would fight the edit path (which would delete follower rows). Instead a standalone chat.db thread_followers table keyed by the thread root (FK ON DELETE CASCADE, so deleting the root cleans up). The notify-bus gains a "thread" branch so the browser notification reads "{author} replied in {room}". #LC-310 #LC-311 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>