Apply code review suggestions manually

This commit is contained in:
Travis Ralston 2022-06-07 17:08:15 -06:00
parent 1653b43cde
commit 67d2847f37
11 changed files with 42 additions and 18 deletions

View file

@ -5,18 +5,42 @@ toc_hide: true
##### `m.room.power_levels` events accept values as strings ##### `m.room.power_levels` events accept values as strings
In order to maintain backwards compatibility with early implementations, In order to maintain backwards compatibility with early implementations,
power levels can optionally be represented in string format instead of each of the integer-valued properties within
integer format. A homeserver must be prepared to deal with this by parsing [`m.room.power_levels`](/client-server-api#mroompower_levels) events can
the power level from a string. In these cases, the following formatting of the be encoded as strings instead of integers. This includes the nested values
power level string is allowed: within the `events`, `notifications` and `users` properties.
For example, the following is a valid `m.room.power_levels` event in this room version:
```json
{
"content": {
"ban": "50",
"events": {
"m.room.power_levels": "100"
},
"events_default": "0",
"state_default": "50",
"users": {
"@example:localhost": "100"
},
"users_default": "0"
},
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
"sender": "@example:example.org",
"state_key": "",
"type": "m.room.power_levels"
}
```
When the value is representative of an integer, they must be the following format:
* a single base 10 integer, no float values or decimal points, optionally with * a single base 10 integer, no float values or decimal points, optionally with
any number of leading zeroes (`"100"`, `"000100"`); any number of leading zeroes (`"100"`, `"000100"`);
* optionally with any number of leading or trailing whitespace characters (`" 100 "`, * optionally prefixed with a single `-` or `+` character before the integer (`"+100"`,
`" 00100 "`);
* optionally prefixed with a single `-` or `+` character before the integer
but after leading whitespace padding (`" +100 "`, `" -100 "`, `"+100"`,
`"-100"`). `"-100"`).
* optionally with any number of leading or trailing whitespace characters (`" 100 "`,
`" 00100 "`, `" +100 "`, `" -100 "`);
{{% boxes/note %}} {{% boxes/note %}}
The integer represented by the string must still be within the `[-(2**53)+1, (2**53)-1]` The integer represented by the string must still be within the `[-(2**53)+1, (2**53)-1]`

View file

@ -48,7 +48,7 @@ Events in version 1 rooms have the following structure:
{{% definition path="api/server-server/definitions/pdu" %}} {{% definition path="api/server-server/definitions/pdu" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -58,7 +58,7 @@ Room version 10 is based upon room version 9 with the following considerations.
The event format is unchanged by this room version. See [below](#event-format-1) The event format is unchanged by this room version. See [below](#event-format-1)
for details on the current event format. for details on the current event format.
#### Deprecated formatting #### Deprecated event content schemas
While this room version does not change the event format specifically, some While this room version does not change the event format specifically, some
deprecated behaviours are strictly no longer supported. deprecated behaviours are strictly no longer supported.

View file

@ -46,7 +46,7 @@ Events in rooms of this version have the following structure:
{{% definition path="api/server-server/definitions/pdu" %}} {{% definition path="api/server-server/definitions/pdu" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -81,7 +81,7 @@ The complete structure of a event in a v3 room is shown below.
{{% definition path="api/server-server/definitions/pdu_v3" %}} {{% definition path="api/server-server/definitions/pdu_v3" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -69,7 +69,7 @@ the changes in this room version.
{{% rver-fragment name="v4-event-format" %}} {{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -51,7 +51,7 @@ completeness.
{{% rver-fragment name="v4-event-format" %}} {{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -212,7 +212,7 @@ completeness.
{{% rver-fragment name="v4-event-format" %}} {{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -205,7 +205,7 @@ completeness.
{{% rver-fragment name="v4-event-format" %}} {{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -110,7 +110,7 @@ completeness.
{{% rver-fragment name="v4-event-format" %}} {{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}

View file

@ -57,7 +57,7 @@ completeness.
{{% rver-fragment name="v4-event-format" %}} {{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting #### Deprecated event content schemas
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}} {{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}