Skip to content
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

Attempt to clarify how event_match works #3690

Merged
merged 4 commits into from
Feb 17, 2022
Merged
Changes from 1 commit
Commits
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
29 changes: 17 additions & 12 deletions content/client-server-api/modules/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,32 +246,29 @@ not have a string value, then the condition will not match, even if `pattern`
is `*`.

{{% boxes/note %}}
For example, if `key` is `content.membership`, and `pattern` is `jo?*`, then
For example, if `key` is `content.topic`, and `pattern` is `lunc?*`, then
the following event will match:

```json
{
"content": {
"membership": "join",
"topic": "Lunch plans",
},
"event_id": "$143273582443PhrSn:example.org",
"room_id": "!636q39766251:example.com",
"sender": "@example:example.org",
"state_key": "@alice:example.org",
"type": "m.room.member"
"state_key": "",
"type": "m.room.topic"
}
```

Other `membership` values which will match are:
Other `topic` values which will match are:

* `"JOIN"`
* `"joinnn"`
* `"join "` (note trailing space)
* `"joy"` (`*` may match zero characters)
* `"LUNCH"` (case-insensitive; `*` may match zero characters)

The following `membership` values will NOT match:
* `" join"` (note leading space)
* `"jo"` (`?` must match a character)
* `" lunch"` (note leading space)
* `"lunc"` (`?` must match a character)
* `null` (not a string)
{{% /boxes/note %}}

Expand Down Expand Up @@ -304,6 +301,14 @@ Other `body` values which will match are:
{{% /boxes/note %}}


richvdh marked this conversation as resolved.
Show resolved Hide resolved
{{% boxes/warning %}}
Note that there is no implicit condition for `state_key`. In other words, push
rules which should match only state events must include an explicit condition
for `state_key`.

For an example of this, see the default rule
[`.m.rule.tombstone`](#mruletombstone) below.
{{% /boxes/warning %}}

**`contains_display_name`**

Expand Down Expand Up @@ -481,7 +486,7 @@ Definition:
}
```

**`.m.rule.tombstone`**
**<a name="mruletombstone"></a>`.m.rule.tombstone`**
Copy link
Member

Choose a reason for hiding this comment

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

screen readers will have a hard time with this, but I'm happy to have this be converted into an issue instead of being fixed in this PR if you'd like though.

Copy link
Member Author

Choose a reason for hiding this comment

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

hrm, sorry, I'm not up to date on how best to support screenreaders. My assumption was that an anchor like this would be very common, and ignored. Is there a better way of doing this?

Copy link
Member

Choose a reason for hiding this comment

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

Fixing our heading structure so these become actual headings (and therefore implicit anchors we can use) would work best, but failing that we'd want to give some content to this like the permalink icons found other headings.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm kinda struggling to envisage what exactly the failure mode is going to be here - if you have a clear idea, perhaps you could open an issue yourself?

I'm going to go ahead and merge this for now.


Matches any state event whose type is `m.room.tombstone`. This is
intended to notify users of a room when it is upgraded, similar to what
Expand Down