mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-02-19 04:23:43 +01:00
Merge 6264b34caf into f92c3579ac
This commit is contained in:
commit
9526fa9f4e
|
|
@ -0,0 +1 @@
|
||||||
|
Clarify meaning of floating-point powerlevels.
|
||||||
40
content/rooms/fragments/v1-floaty-power-levels.md
Normal file
40
content/rooms/fragments/v1-floaty-power-levels.md
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
##### `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 technically different.
|
||||||
|
|
||||||
|
When a float written in exponential notation is unpacked, the decimal portion is removed
|
||||||
|
afterward; for example, `5.114698E4` becomes `51146.98`, which is then truncated to `51146`.
|
||||||
|
|
||||||
|
Note that, since this room version does not enforce that events comply with the requirements
|
||||||
|
of [Canonical JSON](/appendices#canonical-json), power levels can be formatted as floats.
|
||||||
|
|
@ -59,6 +59,8 @@ Events in version 1 rooms have the following structure:
|
||||||
|
|
||||||
{{% rver-fragment name="v1-stringy-power-levels" %}}
|
{{% rver-fragment name="v1-stringy-power-levels" %}}
|
||||||
|
|
||||||
|
{{% rver-fragment name="v1-floaty-power-levels" %}}
|
||||||
|
|
||||||
### Authorization rules
|
### Authorization rules
|
||||||
|
|
||||||
{{% rver-fragment name="v1-auth-rules" %}}
|
{{% rver-fragment name="v1-auth-rules" %}}
|
||||||
|
|
|
||||||
|
|
@ -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-stringy-power-levels" %}}
|
||||||
|
|
||||||
|
{{% rver-fragment name="v1-floaty-power-levels" %}}
|
||||||
|
|
||||||
### Authorization rules
|
### Authorization rules
|
||||||
|
|
||||||
{{% rver-fragment name="v1-auth-rules" %}}
|
{{% rver-fragment name="v1-auth-rules" %}}
|
||||||
|
|
|
||||||
|
|
@ -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-stringy-power-levels" %}}
|
||||||
|
|
||||||
|
{{% rver-fragment name="v1-floaty-power-levels" %}}
|
||||||
|
|
||||||
### Authorization rules
|
### Authorization rules
|
||||||
|
|
||||||
{{% boxes/note %}}
|
{{% boxes/note %}}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ the changes in this room version.
|
||||||
|
|
||||||
{{% rver-fragment name="v1-stringy-power-levels" %}}
|
{{% rver-fragment name="v1-stringy-power-levels" %}}
|
||||||
|
|
||||||
|
{{% rver-fragment name="v1-floaty-power-levels" %}}
|
||||||
|
|
||||||
### Authorization rules
|
### Authorization rules
|
||||||
|
|
||||||
{{% rver-fragment name="v3-auth-rules" %}}
|
{{% rver-fragment name="v3-auth-rules" %}}
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ completeness.
|
||||||
|
|
||||||
{{% rver-fragment name="v1-stringy-power-levels" %}}
|
{{% rver-fragment name="v1-stringy-power-levels" %}}
|
||||||
|
|
||||||
|
{{% rver-fragment name="v1-floaty-power-levels" %}}
|
||||||
|
|
||||||
### Authorization rules
|
### Authorization rules
|
||||||
|
|
||||||
{{% rver-fragment name="v3-auth-rules" %}}
|
{{% rver-fragment name="v3-auth-rules" %}}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue