-
Notifications
You must be signed in to change notification settings - Fork 398
MSC2625: Add mark_unread
push rule action
#2625
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
81cc814
Proposal to add a `mark_unread` push rule action
richvdh 1ea7ebe
formatting tweaks
richvdh fbad6db
clarify
richvdh 8ea805a
Update proposals/2625-mark-unread-push-action.md
richvdh a003131
attempt to clarify affect on push gateway
richvdh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# MSC2625: Add `mark_unread` push rule action | ||
|
||
[Push rule actions](https://matrix.org/docs/spec/client_server/r0.6.1#actions) | ||
affect how a homeserver delivers notifications for events matching a given push | ||
rule. Homeservers also return the number of unread notifications in the `/sync` | ||
response. | ||
|
||
This approach conflates "unread messages" (aka the "badge count") and "messages | ||
that I want to be notified about". Users often want to see the count of unread | ||
messages increasing in a room view, without receiving a push notification for | ||
each such message. | ||
|
||
This proposal suggests adding a new push rule action, and extending the `/sync` | ||
response, to differentiate between these two cases. | ||
|
||
## Proposal | ||
|
||
**New push rule action** | ||
|
||
To the current list of [Push rule | ||
actions](https://matrix.org/docs/spec/client_server/r0.6.1#actions), we add | ||
`mark_unread`, defined as: | ||
|
||
* `mark_unread`: This causes each matching event to contribute to the homeserver's count of | ||
unread messages in the room. | ||
|
||
For compatibility with existing implementations, the `notify` action implies | ||
`mark_unread`. Its definition is therefore updated to: | ||
|
||
* `notify`: This causes each matching event to generate a notification, *as | ||
well as* contributing to the homeserver's count of unread messages in the | ||
room. | ||
|
||
For clarity then: an actions list of `["notify", "mark_unread"]` is the same | ||
as an actions list of just `["notify"]`. | ||
|
||
(Aside: it may be helpful to note that the `dont_notify` action is a no-op: its | ||
presence in the actions list has no effect. See also | ||
https://github.com/matrix-org/matrix-doc/issues/2624.) | ||
|
||
**Extended response to `/sync`** | ||
|
||
In the response to | ||
[/sync](https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-sync), | ||
within the `Unread Notification Counts` structure, we add a mandatory new field | ||
`unread_count`, which gives the number of unread messages which matched a | ||
`mark_unread` or `notify` push rule. | ||
|
||
We expect the following inviariant to hold: | ||
|
||
highlight_count <= notification_count <= unread_count | ||
|
||
**Next steps** | ||
|
||
We expect a future MSC to change the specification of the default push rules so | ||
that `mark_unread` is used in place of `notify` in certain places. That change | ||
is not included in this MSC. | ||
|
||
## Potential issues | ||
|
||
1. It seems counterintuitive that "push rules" are used to determine unread | ||
counts, and that this behaviour appears in the "push" section of the spec, | ||
when no "push" is involved at all. However, that is not a new problem, and | ||
the push rules engine actually fits the purpose quite well here. | ||
|
||
Arguably the problem is in the naming of "push rules", where "event action | ||
rules" or similar might be more appropriate. | ||
|
||
## Alternatives | ||
|
||
The push rules system is complicated: the multiple "kinds" of push rule, the | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
long list of default rules, the fact that clients can change the behaviour of | ||
named push rules, etc. This complexity makes it hard to reason about, and makes | ||
it difficult for Matrix clients to (reliably) represent the user's current | ||
state in a comprehensible way. There is an argument that, rather than adding | ||
yet more complexity, we should either replace it or use a different mechanism | ||
for the new behaviour. | ||
|
||
However, the change proposed here is incremental, and: | ||
* a wholesale redesign would take a lot of time which would be better spent | ||
elsewhere. | ||
* using an alternative mechanism would add complexity overall rather than | ||
reduce it. | ||
|
||
## Security considerations | ||
|
||
None currently foreseen. | ||
|
||
## Unstable prefix | ||
|
||
While this feature is in development, the following names will be in use: | ||
|
||
| Proposed final name | Name while in development | | ||
| --- | --- | | ||
| `mark_unread` | `org.matrix.msc2625.mark_unread` | | ||
| `unread_count` | `org.matrix.msc2625.unread_count` | | ||
|
||
## References | ||
|
||
This document was based on an initial design at https://docs.google.com/document/d/1Fnh8sT_8hmWAZ_Yh9NaB8HI5occNfR4KyQ_NVdnXJzo. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.