-
Notifications
You must be signed in to change notification settings - Fork 399
MSC3758: Add event_property_is
push rule condition kind
#3758
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ebe4900
Create xxxx-expand-push-rule-conditions.md
Fizzadar 9f5d6c3
Rename to proper MSC number
Fizzadar a10d5a2
Add PR number to title & wrap
Fizzadar 5cd4550
Remove list matching part of MSC3758, will propose in a new MSC
Fizzadar ab61044
Link through to the spec for current match type
Fizzadar c11e31e
Switch to `value` instead of `pattern` for match key
Fizzadar 1baf911
Expand missing sections
Fizzadar 1da490c
Fix typo.
clokep d095359
Clarifications from review.
clokep 936071e
Update title in MSC to match PR.
clokep 855ebfc
Update the name of the push rule condition.
clokep 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,68 @@ | ||
# MSC3758: Expand push rule conditions | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Currently the only condition used to match event content for push rules is the `event_match` kind. | ||
This compares a glob-style string against a string value within the event dictionary. The event | ||
dictionary is flattened before conditions are checked to enable matching nested values. | ||
|
||
This approach is currently limited to only checking for string values within the event dictionary | ||
(at any level). This MSC proposes a new exact match type for event content that works with all | ||
JSON types. | ||
|
||
|
||
## Proposal | ||
|
||
### Exact matching event data | ||
|
||
We propose a new type of condition, `exact_event_match`. Similar to the current `event_match` | ||
([link to spec](https://spec.matrix.org/v1.3/client-server-api/#conditions-1)), this condition | ||
takes two parameters: `value` and `key`. The exact match compares the `value` to the event data | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
associated with `key` exactly. Both type and content (when a string) should be identical | ||
(include case). This allows for matching all non-compound JSON types allowed by | ||
[canonical JSON](https://spec.matrix.org/v1.5/appendices/#canonical-json): | ||
i.e. strings, `null`, `true`, `false` and integers. This also provides a simpler | ||
exact string matching mechanism (and any associated performance gains on implementation side without | ||
globbing). | ||
dbkr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
An example condition may look like (encoded as a JSON object): | ||
|
||
```json | ||
{ | ||
"kind": "exact_event_match", | ||
"key": "event.content.is_something", | ||
richvdh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"value": true | ||
} | ||
``` | ||
|
||
|
||
## Alternatives | ||
|
||
[MSC3862](https://github.com/matrix-org/matrix-spec-proposals/pull/3862) proposes an alternative | ||
solution by converting non-string JSON objects to strings in the `event_match` condition type. | ||
|
||
## Security considerations | ||
|
||
None. | ||
clokep marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Future extensions | ||
|
||
A future MSC may wish to define the behavior of `exact_event_match` when | ||
used with a JSON object or array. | ||
|
||
[MSC3887](https://github.com/matrix-org/matrix-spec-proposals/pull/3887) is a | ||
related MSC which attempts to define behavior for searching for a value inside of | ||
an array. | ||
|
||
## Unstable prefix | ||
|
||
While still not part of the Matrix spec, the new rule type should be prefixed as so: | ||
|
||
```json | ||
{ | ||
"kind": "com.beeper.msc3758.exact_event_match", | ||
"key": "..." | ||
} | ||
``` | ||
|
||
## Dependencies | ||
|
||
None. |
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.