mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-29 07:24:09 +02:00
Use jsonschema.
This commit is contained in:
parent
7e11f31fca
commit
9e1a60a2c3
|
|
@ -7,11 +7,11 @@ This module allows users to "mention" other users and rooms within a room event.
|
||||||
This is primarily used as an indicator that the recipient should receive a notification
|
This is primarily used as an indicator that the recipient should receive a notification
|
||||||
about the event.
|
about the event.
|
||||||
This is achieved by including metadata in the `m.mentions` content property of
|
This is achieved by including metadata in the `m.mentions` content property of
|
||||||
the event. The `m.mentions` property consists of an object with two fields:
|
the event to reference the entity being mentioned.
|
||||||
|
|
||||||
* `user_ids`: A list of Matrix IDs of mentioned users.
|
`m.mentions` is defined as follows:
|
||||||
* `room`: A boolean set to `true` to mention the room, for an `@room` notification. (`room` should otherwise
|
|
||||||
not be included on the event.)
|
{{% definition path="api/client-server/definitions/m.mentions" %}}
|
||||||
|
|
||||||
Although it is possible to silently mention users, it is recommended to include a
|
Although it is possible to silently mention users, it is recommended to include a
|
||||||
[Matrix URI](/appendices/#uris) in the HTML body of an [m.room.message](#mroommessage)
|
[Matrix URI](/appendices/#uris) in the HTML body of an [m.room.message](#mroommessage)
|
||||||
|
|
@ -19,21 +19,6 @@ event. This applies only to [m.room.message](#mroommessage) events where the `ms
|
||||||
`m.text`, `m.emote`, or `m.notice`. The `format` for the event must be
|
`m.text`, `m.emote`, or `m.notice`. The `format` for the event must be
|
||||||
`org.matrix.custom.html` and therefore requires a `formatted_body`.
|
`org.matrix.custom.html` and therefore requires a `formatted_body`.
|
||||||
|
|
||||||
To make a mention, reference the entity being mentioned in the
|
|
||||||
`m.mentions` property, like so:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"body": "Hello Alice!",
|
|
||||||
"msgtype": "m.text",
|
|
||||||
"format": "org.matrix.custom.html",
|
|
||||||
"formatted_body": "Hello <a href='https://matrix.to/#/@alice:example.org'>Alice</a>!",
|
|
||||||
"m.mentions": {
|
|
||||||
"user_ids": ["@alice:example.org"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Similarly, the entire room can be mentioned:
|
Similarly, the entire room can be mentioned:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|
|
||||||
37
data/api/client-server/definitions/m.mentions.yaml
Normal file
37
data/api/client-server/definitions/m.mentions.yaml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Copyright 2023 The Matrix.org Foundation C.I.C.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
type: object
|
||||||
|
title: m.mentions
|
||||||
|
description: |-
|
||||||
|
Describes whether the event mentions other users or the room. This is contained
|
||||||
|
within the event's `content` alongside other fields for the relevant event type.
|
||||||
|
example: {
|
||||||
|
"body": "Hello Alice!",
|
||||||
|
"msgtype": "m.text",
|
||||||
|
"format": "org.matrix.custom.html",
|
||||||
|
"formatted_body": "Hello <a href='https://matrix.to/#/@alice:example.org'>Alice</a>!",
|
||||||
|
"m.mentions": {
|
||||||
|
"user_ids": ["@alice:example.org"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
properties:
|
||||||
|
user_ids:
|
||||||
|
type: string[]
|
||||||
|
description: A list of Matrix IDs of mentioned users.
|
||||||
|
room:
|
||||||
|
type: boolean
|
||||||
|
description: |-
|
||||||
|
A boolean set to `true` to mention the room, for an `@room` notification.
|
||||||
|
(`room` should otherwise not be included on the event.)
|
||||||
Loading…
Reference in a new issue