m.room.power_levels events accept values as floats

This commit is contained in:
Kierre 2026-01-25 11:26:52 -05:00
parent 7066694571
commit 68d92cf254
No known key found for this signature in database
GPG key ID: 1C50B6A26C5B1C6E
6 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,34 @@
##### `m.room.power_levels` Events Accept Values as Floats
When the value is a float, anything after the decimal point is removed,
making e.g. `5.17`, `5.42`, and `5` functionally identical.
For example, this 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:example.org": 100,
"@alice:localhost": 50,
"@bob:localhost": 50.57
},
"users_default": 0
},
"origin_server_ts": 1432735824653,
"room_id": "!jEsUZKDJdhlrceRyVU:example.org",
"sender": "@example:example.org",
"state_key": "",
"type": "m.room.power_levels"
}
```
In this example, both `@bob:localhost` and `@alice:localhost` have the same effective
power level of `50`, even though the values are visually different.

View file

@ -59,6 +59,8 @@ Events in version 1 rooms have the following structure:
{{% rver-fragment name="v1-stringy-power-levels" %}}
{{% rver-fragment name="v1-floaty-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v1-auth-rules" %}}

View file

@ -57,6 +57,8 @@ Events in rooms of this version have the following structure:
{{% rver-fragment name="v1-stringy-power-levels" %}}
{{% rver-fragment name="v1-floaty-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v1-auth-rules" %}}

View file

@ -87,6 +87,8 @@ The complete structure of a event in a v3 room is shown below.
{{% rver-fragment name="v1-stringy-power-levels" %}}
{{% rver-fragment name="v1-floaty-power-levels" %}}
### Authorization rules
{{% boxes/note %}}

View file

@ -76,6 +76,8 @@ the changes in this room version.
{{% rver-fragment name="v1-stringy-power-levels" %}}
{{% rver-fragment name="v1-floaty-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v3-auth-rules" %}}

View file

@ -58,6 +58,8 @@ completeness.
{{% rver-fragment name="v1-stringy-power-levels" %}}
{{% rver-fragment name="v1-floaty-power-levels" %}}
### Authorization rules
{{% rver-fragment name="v3-auth-rules" %}}