-
Notifications
You must be signed in to change notification settings - Fork 413
MSC4306: Thread Subscriptions #4306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
3f1e83a
2a72ee4
10e52b0
c901734
f0a7680
513811f
a3dbc87
e1ad4b2
648fda4
84be8db
c974c02
d923774
c3fecfa
d5fd6b0
c05b485
f0a32bf
bd9e842
9db41d8
bd90ea3
212345a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| MSC4306: Thread Subscriptions | ||
| ===== | ||
|
|
||
| ## Background and Summary | ||
|
|
||
| Threads were introduced in [version 1.4 of the Matrix Specification](https://spec.matrix.org/v1.13/changelog/v1.4/) as a way to isolate conversations in a room, making it easier for users to track specific conversations that they care about (and ignore those that they do not). | ||
|
|
||
| Thus far, there has been no good way for users to ensure that they see new messages in only the threads that they care about. The current rules only allow expressing one of two choices: users and their clients can either watch all threads, or ignore all threads. | ||
| As a result, the user is either being presented with unwanted information (misusing their attention), or they risk missing important messages. | ||
|
|
||
| This proposal introduces a new mechanism, Thread Subscriptions, as a first-class way for users to signal which threads they care about. | ||
|
|
||
| We then add a new push rule so that users can receive push notifications only for threads that they care about. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the proposal is to receive notification for all messages from "subscribed" thread could not that be achieved with the existing push rules semantics? Example: {
"conditions": [
{
"kind": "event_property_is",
"key": "content.m\\.relates_to.rel_type",
"value": "m.thread"
},
{
"kind": "event_property_is",
"key": "content.m\\.relates_to.event_id",
"value": "$thread_root_message_id"
}
],
"actions": [
"notify",
{
"set_tweak": "highlight"
}
],
"rule_id": "$thread_root_message_id",
"default": true,
"enabled": true
}There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the set of conditions, where does the fact that the user is subscribed (or not) to a thread appear? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Client can check for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting idea, thanks for bringing it up. I think that it's a tradeoff: the approach you're suggesting here would likely make the size of the rules event blow up, especially thanks to the prescribed automatic subscription mechanisms which could add lots and lots of subscribed threads by default. The approach suggested in this MSC makes it a default rule, that requires a bit more work during evaluation of the push rules (now, a client might need to fetch via network, or load from disk, the subscription status of a thread). The MSC's approach doesn't make the push rules event grow linearly with the number of threads one's subscribed to/muted, which I find a strong benefit here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Main problems I can see are that I would rather avoid speccing anything that depends on an unlimited account data size, ultimately. Other than that, this doesn't support the automatic subscription ordering logic that we need. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After reading again through the msc, I have following concerns which might be helpful for this alternative consideration:
We may can consider this kind of three rules:
Although the event size will always be a limiting factor, but a client can provide a section for all subscribed threads to maintain this list but the experience of such a feature will depend on the quality of implementation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re (2), is there anything preventing a client from reusing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is referring to the user's own 'ignored user' list, not any automated system. (2) can be configured with push rules, but we are cautious about suggesting exposing too many control knobs to users because it makes for confusing UI (3) a room being muted when muted is indeed intentional. As described in the MSC, the mental model is that the 'Mentions & Keyword' setting becomes equivalent to 'Mentions, Keywords & Subscribed Thread' and this is the level we're working at. (Our hands are also tied whilst keeping the push rules as sane as possible, until push rules are replaced in the future) The account data being of unlimited size is considered a mistake, fwiw, therefore I don't buy that we should rely on it for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, since the msc specify that:
any rule added in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I am not sure if i get it correctly. What i mean was that msc says.
user can not get notification for subscribed thread because the room mute rule is added to the |
||
|
|
||
|
|
||
| ## Proposal | ||
|
|
||
| This proposal consists of three main parts: | ||
| - 3 simple endpoints for subscribing to and unsubscribing from threads; | ||
| - new prescribed client behaviour when the user is mentioned in a thread; and | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we also subscribe when a user sends a message within a thread? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes IMO There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the semantics for this in 84be8db, let me know if that works :) |
||
| - a new push rule (including a new push rule condition) that prevents notifying about threads that the user has not subscribed to. | ||
|
|
||
|
|
||
| ### New Endpoints | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why isn't there an endpoint to paginate all thread subscriptions in a room? (my expectation) Similar to how clients back-paginate with messages in a room by starting with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be pretty shoddy for performance if it was per-room (= 1 request needed per room), but maybe a global endpoint would be OK. It just felt like sliding sync would do the job of getting the state down to the client without much fuss (like for room account data), but maybe that's wrong There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We'd need to increase the equivalent of "timeline_limit" to simulate back-pagination, and that complicates a few things:
So agreed with @MadLittleMods that having the same "N last + pagination token if needs be" would be ideal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to boil down to: we should add an endpoint for backpaginating these. I'm tempted to push that into MSC4308 since it seems to complement the Sliding Sync API nicely There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pagination endpoint added in MSC4308 More discussion -> element-hq/synapse#18695 (comment) |
||
|
|
||
| #### Subscribing to a thread | ||
|
|
||
| ``` | ||
| PUT /_matrix/client/v1/rooms/{roomId}/thread/{eventId}/subscription | ||
| ``` | ||
|
|
||
| with request body: | ||
|
|
||
| ```jsonc | ||
| { | ||
| // Whether the subscription was made automatically | ||
| // by a client, not by manual user choice. | ||
| "automatic": true | ||
| } | ||
| ``` | ||
|
|
||
| Returns 200 with empty body `{}`. | ||
|
|
||
| If the thread does not exist, or if the user does not have access to it, returns 404/`M_NOT_FOUND`. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to pre-subscribe to a message so if people thread off it, you can catch it? |
||
|
|
||
| If the thread is already subscribed, then the subscription remains and: | ||
|
|
||
| - if `automatic` is `false`, the thread is marked as manually-subscribed, even if the existing subscription has it marked as automatically subscribed. (In other words, manual subscriptions take precedence over automatic subscriptions.) | ||
|
|
||
|
|
||
| #### Unsubscribing from a thread | ||
| ``` | ||
| DELETE /_matrix/client/v1/rooms/{roomId}/thread/{eventId}/subscription | ||
| ``` | ||
|
|
||
| Returns 200 with empty body `{}`. | ||
|
|
||
| If the thread was not subscribed, returns 200 with empty body `{}` for idempotence. | ||
|
|
||
| If the thread does not exist, or is inaccessible, returns 404/`M_NOT_FOUND`. | ||
|
|
||
|
|
||
| #### Retrieving thread subscription | ||
reivilibre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ``` | ||
| GET /_matrix/client/v1/rooms/{roomId}/thread/{eventId}/subscription | ||
|
|
||
| {"automatic": true} | ||
| ``` | ||
|
|
||
| Retrieves the thread subscription for a given thread. | ||
|
|
||
| On success (200), returns: | ||
|
|
||
| ```jsonc | ||
| { | ||
| // Whether the subscription was automatically made or not | ||
| "automatic": true | ||
| } | ||
| ``` | ||
|
|
||
| If there is no subscription to that thread, or the thread does not exist, or the thread is inaccessible, returns 404/`M_NOT_FOUND`. | ||
|
|
||
|
|
||
| ### New Client Behaviour: subscribe on mention | ||
|
|
||
| When a user is mentioned in a thread (by another user — the *mentioning user*), the user's client should perform an automatic subscription to that thread using `PUT /subscription` with `{"automatic": true}`. | ||
reivilibre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The server does not perform this action on the client's behalf, principally because the server is not able to detect mentions in encrypted rooms. | ||
|
|
||
| If the client is already aware of the user being subscribed to the thread, then making a `PUT /subscription` request is not necessary. | ||
|
|
||
| If the mentioning user is banned, the automatic thread subscription should not occur. | ||
reivilibre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #### Reversal of automatic subscriptions | ||
|
|
||
| If an automatic thread subscription occurs and the mentioning user is subsequently banned, then: | ||
|
|
||
| - the thread subscription should be reversed, | ||
| - provided that there aren't any other mentions by other, non-banned, users that would have caused the same automatic subscription. | ||
|
|
||
| When a client becomes aware of a banned user in a room, it may need to backpaginate thread history to determine whether there are any threads whose automatic subscriptions should be reversed, or to determine if there are any other qualifying mentions that would obviate the need to reverse automatic subscriptions. | ||
|
|
||
| For efficiency reasons, clients may limit the depth of this backpagination with an implementation-defined recency limit, owing to the observation that abuse is usually cleaned up shortly after it occurs. | ||
reivilibre marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### New Push Rules | ||
|
|
||
| As motivation, we want threads to have the following notification semantics: | ||
|
|
||
| - Messages in unsubscribed threads should not count as activity at all; as a user, I do not want to see the room as unread because there are new messages in an unsubscribed thread. | ||
| - Exceptions: if the user is mentioned, this should generate a notification as usual. (The push notification thus generated is also useful for the client to realise it needs to create an automatic thread subscription.) | ||
|
Comment on lines
+175
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the default thread subscription state is "unsubscribed", could not this confuse user as the propose of showing "activity" is to advertise user that there can be possible interesting conversation. This suggestion can make user missing them. Also the exceptions mentions to generate notification for "mentions" which includes room mentions, user/fallback mention, user configured keywords. but the push rule semantic is free for other personal customization wondering how that will with work with them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default 'unsubscription' state is intended to reduce noise and notification fatigue, so keeping it squirreled away in the UI is kind of intentional — not that you can't have other UI to surface missed activity there, just that it shouldn't (in principle) count as noisy room activity. The semantics are written in https://github.com/matrix-org/matrix-spec-proposals/pull/4306/files#diff-f42a2b8bda41aad63a982965d5f5b7165e62ddc06484c0ee3806024646ab9fdaR140 and should generalise semi-well (about as well as one could hope, given the free-for-all nature of push rules) to custom rules. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The proposals says:
It says unread (generally a dot without count) compare to notification (noisy/not) (badge with count). Notifications as badge-with-count are suppressed purposefully but unread as dot-without-count indicate general room activity is what I have concern about. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, suppressing the indicator of room-wide activity is considered a good thing, because it reduces the cognitive load on users. But for use cases where it's important to see all activity, I think it is easy to either disable the push rule or provide other UI if necessary |
||
| - Messages in subscribed threads should always count as a notification, and the (effective) room notification settings should not matter at all. E.g. the room can be muted, but if I, as a user, am subscribed to a thread, I still want to get a notification for new messages in that thread. If I do not want that, then I will unsubscribe. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An API listing active subscriptions per room might also make unsubscribing easier? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When a user mutes a room, it puts an override rule in for that room. And this override rule is the highest priority So this is not possible to receive notification from a thread in a muted room. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what it's worth, I thought there was a little chicken-and-egg problem here, in the case of a new automatic subscription, but turns out there might not be. Say I receive an event that would automatically subscribe me to a thread I haven't subscribed to (nor unsubscribed from). At this point, the thread subscription push rule wouldn't be triggered, because the subscription doesn't exist quite yet. But I'd expect the client to still notify about the thing! However, if an automatic subscription were to happen, that's likely because other push rules decided so: I've been mentioned in the thread, or there was a keyword mention, or something else. So there should be some notification created for that other event, which then causes the automatic subscription to the thread. A notification will exist for the initial event that causes an automatic subscription; it is just not created by the new push rule yet. Future events in this thread will imply notifications because of the thread subscription push rule. Am I getting this right? If so, it may be worth mentioning this around here, to help client implementations? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, you have it right. Though looking at it now, this |
||
|
|
||
| To achieve this, we propose the addition of two new push rules: | ||
|
|
||
| 1. an `override` push rule, called `.m.rule.unsubscribed_thread`, at the end of the override list. This rule causes events in unsubscribed threads to skip notification processing without generating a notification. | ||
| The rule occurs after mention-specific rules, meaning that mentions continue to generate notifications. | ||
| **TODO how do we deal with keyword mentions** | ||
| ```jsonc | ||
| { | ||
| "rule_id": ".m.rule.unsubscribed_thread", | ||
| "default": true, | ||
| "enabled": true, | ||
| "conditions": [ | ||
| { | ||
| "kind": "thread_subscription", | ||
| "subscribed": false | ||
| } | ||
| ], | ||
| "actions": [] | ||
| } | ||
| ``` | ||
| 2. an `underride` push rule, called `.m.rule.subscribed_thread`, at the beginning of the underride list. This rule causes events in subscribed threads to generate notifications. | ||
| ```jsonc | ||
| { | ||
| "rule_id": ".m.rule.subscribed_thread", | ||
| "default": true, | ||
| "enabled": true, | ||
| "conditions": [ | ||
| { | ||
| "kind": "thread_subscription", | ||
| "subscribed": true | ||
| } | ||
| ], | ||
| "actions": [ | ||
| "notify", | ||
| { | ||
| "set_tweak": "sound", | ||
| "value": "default" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| These push rules use a new push condition `thread_subscription`, which takes an argument `subscribed` (boolean). | ||
| The `thread_subscription` push condition is satisfied if and only if all the following hold: | ||
| 1. the event, which we are running push rules for, is part of a thread. | ||
| 2. the user is subscribed to the thread (`subscribed` = `true`) or is not subscribed to the thread (`subscribed` = `false`). | ||
|
|
||
| ## Limitations | ||
|
|
||
| - Users will not have enough granularity to subscribe to threads in a way that lets them keep track of threads (being able to 'catch up' through some mechanism in their client) without also getting notifications for them, except by disabling ALL thread subscription notifications altogether. | ||
| - There is precedent for this granularity in the popular forum software *Discourse*, but the author is not aware of Instant Messaging software with this granularity. | ||
| - With that said, this could be feasibly extended by a later MSC with no apparent issues. | ||
|
|
||
| ## Alternatives | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm kind of surprised there's no changes to the |
||
|
|
||
| - Clients could maintain thread subscription settings in Room Account Data, as a map from event ID to the subscription settings. | ||
| - This would be inefficient by requiring the entire subscription set for an entire room to be transferred at once, for example in Sliding Sync. | ||
| - This would make subscriptions vulnerable to Read-Modify-Write race conditions (though this could be addressed with extensions to the Room Account Data APIs). | ||
|
Comment on lines
+262
to
+264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My hope was you could use (room) account data, but that doesn't have a "state key" or anything. I think it also limits you in size, which probably wouldn't work. 😢 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was also thinking of account data and I believe it isn't subject to the 64KiB limit? What were you planning to use a state key for with thread subscriptions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using account data in this way may not have the 64 kiB limit, but ideally we should try to avoid using it in more places that will make it hard to add that limit. (Since the lack of a limit is a mistake, I believe.) The two problems I noted above are the main reasons I don't like using account data here:
I think Patrick's 'state key' mention is along the lines of: 'we only have a single key for each piece of room account data: the type'. Or we could stretch things further to have 'Event Account Data' or something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Oh, I see. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Correct. And your example of a state keys is spot on for what I was thinking. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if expanding this to "relation subscriptions" would be helpful for any other use-cases. So a subscription is parent event+relation type? Might not be super useful with the current relations though. |
||
| - Clients could maintain their thread subscription settings in their global Account Data, but this seems to be strictly worse than doing so in Room Account Data. | ||
|
|
||
| ## Security considerations | ||
|
|
||
| - Abuse of 'subscribe on mention', particularly in public rooms | ||
| - Malicious users can be ignored by the user, to stop the subscribe on mention behaviour. | ||
| - Users can disable notifications entirely for rooms. | ||
| - Room moderators can take action against malicious users abusing the feature. | ||
| - If no room moderators are protecting the user, the user can of course also leave the room. | ||
|
|
||
| ## Notes to Client Implementors | ||
|
|
||
| ## Notes to Server Implementors | ||
|
|
||
| - Since clients will be automatically updating the Thread Subscription Settings when their user is mentioned, server implementations should be ready to handle concurrent updates by multiple of the user's devices/clients when they are online at the same time. | ||
|
|
||
| ## Unstable prefix | ||
|
|
||
| TODO! | ||
|
|
||
|
|
||
| ## Dependencies | ||
|
|
||
| - no dependencies on other pending MSCs | ||
|
|
||
| ## Dependents | ||
|
|
||
| This proposal is known to be depended upon by the following MSCs: | ||
|
|
||
| - <a name="ref-ss-ext"></a>\<proto-MSC for Thread Subscriptions extension to Sliding Sync\> | ||
Uh oh!
There was an error while loading. Please reload this page.