Move stringy power levels to room versions

This commit is contained in:
Travis Ralston 2022-05-30 13:48:27 -06:00
parent 503a815c66
commit 3dd5bee5ef
12 changed files with 85 additions and 15 deletions

View file

@ -0,0 +1,9 @@
Events sent into rooms of this version can have formats which are different
from their normal schema. Those cases are documented here.
{{% boxes/warning %}}
The behaviour described here is preserved strictly for backwards compatibility
only. A homeserver should take reasonable precautions to prevent users from
sending these so-called "malformed" events, and must never rely on the behaviours
described here as a default.
{{% /boxes/warning %}}

View file

@ -0,0 +1,15 @@
##### Power levels accepted as strings
In order to maintain backwards compatibility with early implementations,
power levels can optionally be represented in string format instead of
integer format. A homeserver must be prepared to deal with this by parsing
the power level from a string. In these cases, the following formatting of the
power level string is allowed:
* a single Base10 integer, no float values or decimal points, optionally with
any number of leading zeroes (`"100"`, `"000100"`);
* optionally with any number of leading or trailing whitespace characters (`" 100 "`,
`" 00100 "`);
* optionally prefixed with a single `-` or `+` character before the integer
but after leading whitespace padding (`" +100 "`, `" -100 "`, `"+100"`,
`"-100"`).

View file

@ -48,6 +48,12 @@ Events in version 1 rooms have the following structure:
{{% definition path="api/server-server/definitions/pdu" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v1-auth-rules" %}}

View file

@ -46,6 +46,12 @@ Events in rooms of this version have the following structure:
{{% definition path="api/server-server/definitions/pdu" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v1-auth-rules" %}}

View file

@ -81,6 +81,12 @@ The complete structure of a event in a v3 room is shown below.
{{% definition path="api/server-server/definitions/pdu_v3" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### Authorization rules
{{% added-in this=true %}} `m.room.redaction` events are no longer

View file

@ -69,6 +69,12 @@ the changes in this room version.
{{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v3-auth-rules" %}}

View file

@ -51,6 +51,12 @@ completeness.
{{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v3-auth-rules" %}}

View file

@ -212,6 +212,12 @@ completeness.
{{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### State resolution
{{% rver-fragment name="v2-state-res" %}}

View file

@ -205,6 +205,12 @@ completeness.
{{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### State resolution
{{% rver-fragment name="v2-state-res" %}}

View file

@ -110,6 +110,12 @@ completeness.
{{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### State resolution
{{% rver-fragment name="v2-state-res" %}}

View file

@ -102,6 +102,12 @@ completeness.
{{% rver-fragment name="v4-event-format" %}}
#### Deprecated formatting
{{% rver-fragment name="v1-deprecated-formatting-off-spec" %}}
{{% rver-fragment name="v1-stringy-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v8-auth-rules" %}}

View file

@ -394,22 +394,14 @@ unspecified.
For an `m.room.member` state event, the user given by the `state_key` of
the event.
**Historical String Power Levels** \
In order to maintain backwards compatibility with early implementations,
power levels can optionally be represented in string format instead of
integer format. A homeserver must be prepared to deal with this by parsing
the power level from a string. In these cases, the following formatting of the
power level string is allowed:
- a single Base10 integer, no float values or decimal points, optionally with leading zeroes;
- optionally with leading or trailing whitespace characters;
- optionally prefixed with a single `-` or `+` character before the integer but after leading whitespace padding.
{{% boxes/warning %}}
This behaviour is preserved strictly for backward compatibility only. A
homeserver should take reasonable precautions to prevent users from
sending new power level events with string values and must never
populate the default power levels in a room as string values.
Some [room versions](/rooms) accept power level values to be represented as
strings rather than integers. This is strictly for backwards compatibility.
A homeserver should take reasonable precautions to prevent users from sending
new power level events with string values (eg: by rejecting the API request),
and must never populate the default power levels in a room as string values.
See the [room version specification](/rooms) for more information.
{{% /boxes/warning %}}
#### Authorization rules