Skip to content

feat: MSC4306 thread subscription button and auto-subscribe behaviours#33370

Draft
nathanael-h wants to merge 1 commit intoelement-hq:developfrom
nathanael-h:feat/thread-subscription-button
Draft

feat: MSC4306 thread subscription button and auto-subscribe behaviours#33370
nathanael-h wants to merge 1 commit intoelement-hq:developfrom
nathanael-h:feat/thread-subscription-button

Conversation

@nathanael-h
Copy link
Copy Markdown

@nathanael-h nathanael-h commented May 4, 2026

Summary

  • ThreadSubscriptionButton: Follow/Following button with bell icon in the thread view header, using MSC4306 PUT/DELETE/GET …/subscription endpoints via new matrix-js-sdk methods.
  • Subscribe-on-send (Behaviour A): when the user sends a message in a thread, a fire-and-forget PUT /subscription (manual, body {}) is issued.
  • Subscribe-on-mention (Behaviour B): when an incoming thread event triggers a notify push action, PUT /subscription with {"automatic": "$causeEventId"} is sent — unless the sender is ignored/banned or we've already subscribed this session. 409 M_CONFLICTING_UNSUBSCRIPTION is gracefully swallowed.
  • In-session cache (autoSubscribedThreads Set + SDK-level cache) to avoid duplicate PUTs.
Capture d’écran du 2026-05-04 17-33-12 Capture d’écran du 2026-05-04 17-33-08

Depends on: matrix-org/matrix-js-sdk#5311
Ref: matrix-org/matrix-spec-proposals#4306

Test plan

  • Open a thread → button shows "Follow" or "Following" based on subscription state
  • Click "Follow" → PUT /subscription with {}, button toggles to "Following"
  • Click "Following" → DELETE /subscription, button toggles to "Follow"
  • Send a reply in a thread → network tab shows PUT /subscription with body {}
  • Receive a mention in a thread from another user → network tab shows PUT /subscription with {"automatic":"$eventId"}
  • Ignored/banned sender mention → no PUT fires
  • Unfollow a thread, receive a mention → 409 swallowed, button stays "Follow"

@github-actions github-actions Bot added the Z-Community-PR Issue is solved by a community member's PR label May 4, 2026
- Add ThreadSubscriptionButton with Follow/Following text and bell icon,
  placed in the thread view header.
- Subscribe-on-send: automatically PUT subscription when user sends a
  message in a thread (MSC4306 Behaviour A).
- Subscribe-on-mention: automatically PUT subscription with
  `{automatic: "$eventId"}` when an incoming thread event triggers a
  notify push action, skipping ignored/banned senders (MSC4306 Behaviour B).
- Session-level cache to avoid duplicate PUT requests.
- Uses new matrix-js-sdk MSC4306 methods (subscribeToThread, etc.).

Depends on: matrix-org/matrix-js-sdk#5311
Ref: matrix-org/matrix-spec-proposals#4306
@nathanael-h nathanael-h force-pushed the feat/thread-subscription-button branch from d0599f5 to 52567d8 Compare May 4, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant