Clarify pattern and key more

Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de>
pull/3664/head
Nicolas Werner 4 years ago
parent 070babcec5
commit 06b539379b
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9

@ -45,19 +45,15 @@ messages.
- `key` (optional): The dot-separated field of the event to match, e.g. `content.body` - `key` (optional): The dot-separated field of the event to match, e.g. `content.body`
or `sender`. If it is not present, the condition should match all events, or `sender`. If it is not present, the condition should match all events,
that have a relation of type `rel_type`. that have a relation of type `rel_type`.
- `pattern` (optional): The glob-style pattern to match against. Patterns with - `pattern` (optional): The glob-style pattern to match against.
no special glob characters should be treated as having asterisks prepended
and appended when testing the condition. If this is not present, it should
match everything if the specific key is present.
`key` and `pattern` have exactly the same meaning as in `event_match` `key` and `pattern` have exactly the same meaning as in `event_match`
conditions, the wording is taken from the current spec. The wording of that is conditions. See https://github.com/matrix-org/matrix-doc/issues/2637 for a
currently debated in https://github.com/matrix-org/matrix-doc/issues/2637 and clarification of their behaviour.
this MSC just follows whatever the spec does for `event_match`.
`key` and `pattern` are optional to allow you to enable or suppress all `key` and `pattern` are optional to allow you to enable or suppress all
notifications for a specific event type. For example one could suppress notifications for a specific relation type. For example one could suppress
notifications for all events in notifications for all events with a realation from
[threads](https://github.com/matrix-org/matrix-doc/pull/3440) and all [threads](https://github.com/matrix-org/matrix-doc/pull/3440) and all
[edits](https://github.com/matrix-org/matrix-doc/pull/2676) with the following [edits](https://github.com/matrix-org/matrix-doc/pull/2676) with the following
two conditions: two conditions:
@ -76,11 +72,11 @@ two conditions:
} }
``` ```
Without a `key` the push rule can be evaluated without fetching the related to Without a `key` and `pattern` the push rule can be evaluated without fetching
event. If only `key` is present, `pattern` should be assumed to be `*`, which the related to event. If one of those two fields is missing, a server should
allows you to match for a field being present regardless of its value. If only prevent those rules from being added with the appropriate error code. (A client
`pattern` is present, servers should return an error when setting the rule. wouldn't have a choice but to ignore those keys if the server failed to prevent
Clients should ignore the `pattern` field if there is no `key` field. the rule from being added.)
A client can check for the `related_event_match` condition being supported by A client can check for the `related_event_match` condition being supported by
testing for an existing `.m.rule.reply` in the default rules. testing for an existing `.m.rule.reply` in the default rules.

Loading…
Cancel
Save