Skip to content
Open
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions proposals/4306-thread-subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ As motivation, we want threads to have the following notification semantics:
- 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.)
- 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An API listing active subscriptions per room might also make unsubscribing easier?

Copy link
Member

Choose a reason for hiding this comment

The 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.
The manual subscription should be disabled in this room at the UI level until the end user unmutes the room.
When a room is muted, the client should pursue the automatic thread subscriptions. These subscriptions will be ignored until the room is unmuted Keep managing the automatic subscription eases the potential switch mute/unmute of a room. The client UI should let the end user know any potential thread subscription is disabled in a muted room

Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you have it right.
Notably, the push rule unsubscribed_thread is lower priority than the push rules for mentions, so it won't prevent you getting notifications for mentions

Though looking at it now, this unsubscribed_thread does have higher priority than the rule that makes the server always push encrypted events to clients, so that's an angle we might need to find a solution for.
Could well be 'this rule needs to get ignored on encrypted events' :/


To achieve this, we propose the addition of two new push rules:
To achieve this, we propose the addition of two new push rules, both added to a new push rule `kind` called `postcontent`, which is ordered between `content` and `room` but which can contain general-purpose rules:

1. an `underride` push rule, called `.m.rule.unsubscribed_thread`, at the beginning of the underride list. This rule causes events in unsubscribed threads to skip notification processing without generating a notification.
1. `.m.rule.unsubscribed_thread`, at the beginning of the underride list. This rule causes events in unsubscribed threads to skip notification processing without generating a notification.
The rule occurs after mention-specific rules and keyword mention rules, meaning that mentions continue to generate notifications.
```jsonc
{
Expand All @@ -194,7 +194,7 @@ To achieve this, we propose the addition of two new push rules:
"actions": []
}
```
2. an `underride` push rule, called `.m.rule.subscribed_thread`, at the beginning of the underride list (following `.m.rule.unsubscribed_thread`). This rule causes events in subscribed threads to generate notifications.
2. `.m.rule.subscribed_thread`, at the beginning of the underride list (following `.m.rule.unsubscribed_thread`). This rule causes events in subscribed threads to generate notifications.
```jsonc
{
"rule_id": ".m.rule.subscribed_thread",
Expand All @@ -221,6 +221,33 @@ The `thread_subscription` push condition is satisfied if and only if all the fol
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`).

### Explanation of the rationale behind the `postcontent` push rule kind

We need a new push rule kind ordered between `content` and `room` because:

**For `.m.rule.unsubscribed_thread`**
- this rule must come after any keyword mentions the user has configured (which would be configured in `content`)
as those should still trigger mentions (and thus automatic thread subscriptions).
- the rule must come before any room settings the user has configured, such as notifying on all messages in a room,
as that would cause automatic subscriptions to every thread in the room and it would cause inconsistencies
between the default 'notified for all messages' behaviour and 'notified for all messages in this room'.

**For `.m.rule.subscribed_thread`**
- it seems inappropriate for an `override` rule to produce notifications, given the `override` rules generally
are intended to suppress them.
- more concretely, we should allow rules in the `override` and `content` block the opportunity to produce
notifications with specific tweaks, e.g. `content` rules to match mentions might highlight the messages
rather than simply notifying.
- `.m.rule.contains_user_name` and user-specified keyword mention rules must therefore execute first
so they can make use of `"set_tweak": "highlight"`.
- this rule should come after `content` in case any users perform negative filtering (i.e. suppressing
notifications for messages containing certain keywords), although the author is not aware of clients with
such functionality.
- this rule must come before `room` to avoid thread subscriptions being defeated by user rules such as
the ones underlying 'Mentions only' or 'Mentions & Keywords' settings available in common clients.

For the time being, servers MUST ensure that clients MUST NOT be able to create custom rules with this push rule kind.

## Limitations and Potential Future Expansions

- 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.
Expand Down