Skip to content

feat: add MSC4306 thread subscription API and push condition#5311

Draft
nathanael-h wants to merge 1 commit intomatrix-org:developfrom
nathanael-h:feat/msc4306-thread-subscriptions
Draft

feat: add MSC4306 thread subscription API and push condition#5311
nathanael-h wants to merge 1 commit intomatrix-org:developfrom
nathanael-h:feat/msc4306-thread-subscriptions

Conversation

@nathanael-h
Copy link
Copy Markdown

Summary

  • Adds subscribeToThread(), unsubscribeFromThread(), getThreadSubscription() methods on MatrixClient using the /_matrix/client/unstable/io.element.msc4306 prefix.
  • Adds an in-memory subscription cache (getCachedThreadSubscription()) for synchronous lookups from PushProcessor.
  • Extends PushProcessor to evaluate the new thread_subscription / io.element.msc4306.thread_subscription push-rule condition kind, backed by the cache (fails closed when subscription state is unknown).

Ref: matrix-org/matrix-spec-proposals#4306

Test plan

  • Build passes (pnpm build)
  • Existing PushProcessor tests pass (pnpm test -- src/pushprocessor)
  • Add unit test for the thread_subscription condition (subscribed, unsubscribed, unknown cache states)
  • Integration: link into element-web, verify subscribeToThread / unsubscribeFromThread produce correct requests

Add client-side support for MSC4306 (Thread Subscriptions):

- `subscribeToThread()`, `unsubscribeFromThread()`, `getThreadSubscription()`
  methods on `MatrixClient` using the unstable prefix
  `/_matrix/client/unstable/io.element.msc4306`.
- In-memory subscription cache (`getCachedThreadSubscription()`) for
  synchronous lookups from `PushProcessor`.
- New `thread_subscription` / `io.element.msc4306.thread_subscription`
  condition kind in `PushProcessor.eventFulfillsCondition()`, backed
  by the cache (fails closed when state is unknown).

Ref: matrix-org/matrix-spec-proposals#4306
@github-actions github-actions Bot added the Z-Community-PR Issue is solved by a community member's PR label May 4, 2026
nathanael-h added a commit to nathanael-h/element-web that referenced this pull request 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
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