-
Notifications
You must be signed in to change notification settings - Fork 385
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
MSC3933: Core push rules for Extensible Events #3933
Open
turt2live
wants to merge
3
commits into
main
Choose a base branch
from
travis/msc/extev/push-rules
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+246
−0
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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,246 @@ | ||
# MSC3933: Core push rules for Extensible Events | ||
|
||
[MSC1767](https://github.com/matrix-org/matrix-spec-proposals/pull/1767) covers a system for extending | ||
events with alternative representations for maximally compatible content in Matrix, however does not | ||
declare the exact push rules needed to replace the existing `m.room.message`-based ones. This proposal | ||
defines those push rules. | ||
|
||
Only push rules for the following MSCs are considered - other MSCs, including possible future ones, are | ||
expected to cover any other push rules needed for the extensible events system. | ||
|
||
* [MSC1767 - Text and Encryption](https://github.com/matrix-org/matrix-doc/pull/1767) | ||
* [MSC3551 - Files](https://github.com/matrix-org/matrix-doc/pull/3551) | ||
* [MSC3552 - Images and Stickers](https://github.com/matrix-org/matrix-doc/pull/3552) | ||
* [MSC3553 - Videos](https://github.com/matrix-org/matrix-doc/pull/3553) | ||
* [MSC3927 - Audio](https://github.com/matrix-org/matrix-doc/pull/3927) | ||
|
||
## Proposal | ||
|
||
[MSC1767](https://github.com/matrix-org/matrix-spec-proposals/pull/1767) already specifies that an | ||
`event_match` condition of `content.body` actually inspects `m.markup`, and as such, we use that | ||
functionality in this proposal. | ||
|
||
[A number of underride rules](https://spec.matrix.org/v1.4/client-server-api/#default-underride-rules) | ||
already exist to cover `m.room.encrypted` and `m.room.message` events, and with these events being | ||
split into several other event types it is important to maintain the same notification state for users | ||
participating in extensible event-capable room versions. | ||
|
||
Using [MSC3931](https://github.com/matrix-org/matrix-spec-proposals/pull/3931) and | ||
[MSC3932](https://github.com/matrix-org/matrix-spec-proposals/pull/3932), we define the following | ||
additional underride push rules for users: | ||
|
||
**One-to-one (DM) rules** | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.encrypted_room_one_to_one` | ||
"rule_id": ".m.rule.extensible.encrypted_room_one_to_one", // note the `.extensible` part | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "room_member_count", "is": "2" }, | ||
{ "kind": "event_match", "key": "type", "pattern": "m.encrypted" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": [ | ||
"notify", | ||
{ "set_tweak": "sound", "value": "default" } | ||
] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.room_one_to_one` | ||
"rule_id": ".m.rule.extensible.message.room_one_to_one", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "room_member_count", "is": "2" }, | ||
{ "kind": "event_match", "key": "type", "pattern": "m.message" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": [ | ||
"notify", | ||
{ "set_tweak": "sound", "value": "default" } | ||
] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.room_one_to_one` | ||
"rule_id": ".m.rule.extensible.file.room_one_to_one", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "room_member_count", "is": "2" }, | ||
{ "kind": "event_match", "key": "type", "pattern": "m.file" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": [ | ||
"notify", | ||
{ "set_tweak": "sound", "value": "default" } | ||
] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.room_one_to_one` | ||
"rule_id": ".m.rule.extensible.image.room_one_to_one", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "room_member_count", "is": "2" }, | ||
{ "kind": "event_match", "key": "type", "pattern": "m.image" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": [ | ||
"notify", | ||
{ "set_tweak": "sound", "value": "default" } | ||
] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.room_one_to_one` | ||
"rule_id": ".m.rule.extensible.video.room_one_to_one", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "room_member_count", "is": "2" }, | ||
{ "kind": "event_match", "key": "type", "pattern": "m.video" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": [ | ||
"notify", | ||
{ "set_tweak": "sound", "value": "default" } | ||
] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.room_one_to_one` | ||
"rule_id": ".m.rule.extensible.audio.room_one_to_one", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "room_member_count", "is": "2" }, | ||
{ "kind": "event_match", "key": "type", "pattern": "m.audio" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": [ | ||
"notify", | ||
{ "set_tweak": "sound", "value": "default" } | ||
] | ||
} | ||
``` | ||
|
||
**Non-DM rules** | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.encrypted` | ||
"rule_id": ".m.rule.extensible.encrypted", // note the `.extensible` part | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "event_match", "key": "type", "pattern": "m.encrypted" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": ["notify"] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.message` | ||
"rule_id": ".m.rule.extensible.message", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "event_match", "key": "type", "pattern": "m.message" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": ["notify"] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.message` | ||
"rule_id": ".m.rule.extensible.file", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "event_match", "key": "type", "pattern": "m.file" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": ["notify"] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.message` | ||
"rule_id": ".m.rule.extensible.image", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "event_match", "key": "type", "pattern": "m.image" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": ["notify"] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.message` | ||
"rule_id": ".m.rule.extensible.video", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "event_match", "key": "type", "pattern": "m.video" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": ["notify"] | ||
} | ||
``` | ||
```json5 | ||
{ | ||
// Inspired by `.m.rule.message` | ||
"rule_id": ".m.rule.extensible.audio", // note the `.extensible` part & event type reference | ||
"default": true, | ||
"enabled": true, | ||
"conditions": [ | ||
{ "kind": "event_match", "key": "type", "pattern": "m.audio" }, // new event type | ||
{ "kind": "room_version_supports", "feature": "m.extensible_events" } // new condition | ||
], | ||
"actions": ["notify"] | ||
} | ||
``` | ||
|
||
For clarity, clients are not required to represent each of these rules as individual toggles: they | ||
can (and likely should) represent them all behind a single flag for better understanding for users. | ||
|
||
This MSC does not currently replace some other push rules, such as `.m.rule.call`, despite them | ||
being impacted by Extensible Events - these are largely left for a future MSC. | ||
|
||
## Potential issues | ||
|
||
These rules are extremely verbose and relatively mechanical in nature, and further do not solve the | ||
problem where a client might decide to render an unknown event like an image while not counting it | ||
as a notification - while regrettable, this proposal defers a more sophisticated system to a later | ||
MSC. | ||
|
||
## Alternatives | ||
|
||
More sophisticated approaches are likely possible. These are deferred to other MSCs - this proposal | ||
aims to fill a gap as quickly as possible. | ||
|
||
## Security considerations | ||
|
||
No new security considerations as this simply takes existing rules and splits them down for extensible | ||
events. However, server implementations may wish to relax rate limits on some push rule endpoints, like | ||
[`PUT /enabled`](https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3pushrulesscopekindruleidenabled) | ||
and others used by clients to enable/alter push rules for bulk operations. An alternative to relaxing | ||
rate limiting is to use [MSC3934](https://github.com/matrix-org/matrix-spec-proposals/pull/3934) or | ||
similar instead. | ||
|
||
## Unstable prefix | ||
|
||
While this proposal is not considered stable, implementations should use `org.matrix.msc3933.*` in place | ||
of `m.*`, noting that the event types themselves in the conditions might use a different unstable prefix. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might need a special rule to replace
.m.rule.suppress_notices
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... or this might be a topic for MSC3955? somewhere, anyway!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is yet another unwritten MSC, or maybe MSC3955 indeed. Here is a fine place for the thread at least.