Skip to content

Commit 77f02e6

Browse files
NickCaoS7evinK
andauthored
Default PowerLevelContent.Invite to 0 per matrix spec (#416)
The default power level for invite was wrong in matrix spec v1.1[1], and has been fixed in v1.3, bringing us in line with synase[2]. [1] matrix-org/matrix-spec@136b5c9 [2] https://github.com/matrix-org/synapse/blob/v1.92.3/synapse/handlers/event_auth.py#L138 ### Pull Request Checklist * [x] Pull request includes a [sign off](https://github.com/matrix-org/dendrite/blob/master/docs/CONTRIBUTING.md#sign-off) Signed-off-by: `Nick Cao <[email protected]>` Signed-off-by: Nick Cao <[email protected]> Co-authored-by: Till <[email protected]>
1 parent 79fcff2 commit 77f02e6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

event_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func TestEventHistoryVisibility(t *testing.T) {
169169
}
170170

171171
func TestEventPowerLevels(t *testing.T) {
172-
eventJSON := `{"auth_events":[["$BqcTUuCsN3g6Rj1z:localhost",{"sha256":"QHTrdwE/XVTmAWlxFwHPW7fp3JioRu6OBBRs+FI/at8"}],["$9fmIxbx4IX8w1JVo:localhost",{"sha256":"gee+f1VoNeYGGczs5lwnUO1qeKAh70Hw23ws+YfDYGY"}]],"content":{"ban":50,"events":null,"events_default":0,"invite":50,"kick":50,"redact":50,"state_default":50,"users":null,"users_default":0,"notifications":{"room":50}},"depth":4,"event_id":"$1570trwyGMovM5uU:localhost","hashes":{"sha256":"QvWo2OZufVTMUkPcYQinGVeeHEODWY6RUMaHRxdT31Y"},"origin":"localhost","origin_server_ts":0,"prev_events":[["$QAhQsLNIMdumtpOi:localhost",{"sha256":"RqoKwu8u8qL+wDoka23xvd7t9UoOXLRQse/bK3o9qLE"}]],"prev_state":[],"room_id":"!roomid:localhost","sender":"@userid:localhost","signatures":{"localhost":{"ed25519:auto":"0oPZsvPkbNNVwRrLAP+fEyxFRAIUh0Zn7NPH3LybNC8lMz0GyPtN1bKlTVQYMwZBTXCV795s+CEgoIX+M5gkAQ"}},"state_key":"","type":"m.room.power_levels"}`
172+
eventJSON := `{"auth_events":[["$BqcTUuCsN3g6Rj1z:localhost",{"sha256":"QHTrdwE/XVTmAWlxFwHPW7fp3JioRu6OBBRs+FI/at8"}],["$9fmIxbx4IX8w1JVo:localhost",{"sha256":"gee+f1VoNeYGGczs5lwnUO1qeKAh70Hw23ws+YfDYGY"}]],"content":{"ban":50,"events":null,"events_default":0,"invite":0,"kick":50,"redact":50,"state_default":50,"users":null,"users_default":0,"notifications":{"room":50}},"depth":4,"event_id":"$1570trwyGMovM5uU:localhost","hashes":{"sha256":"QvWo2OZufVTMUkPcYQinGVeeHEODWY6RUMaHRxdT31Y"},"origin":"localhost","origin_server_ts":0,"prev_events":[["$QAhQsLNIMdumtpOi:localhost",{"sha256":"RqoKwu8u8qL+wDoka23xvd7t9UoOXLRQse/bK3o9qLE"}]],"prev_state":[],"room_id":"!roomid:localhost","sender":"@userid:localhost","signatures":{"localhost":{"ed25519:auto":"0oPZsvPkbNNVwRrLAP+fEyxFRAIUh0Zn7NPH3LybNC8lMz0GyPtN1bKlTVQYMwZBTXCV795s+CEgoIX+M5gkAQ"}},"state_key":"","type":"m.room.power_levels"}`
173173
event, err := newEventFromTrustedJSONV1([]byte(eventJSON), false, MustGetRoomVersion(RoomVersionV1))
174174
if err != nil {
175175
t.Fatal(err)

eventcontent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,9 +429,9 @@ func NewPowerLevelContentFromAuthEvents(authEvents AuthEventProvider, creatorUse
429429
}
430430

431431
// Defaults sets the power levels to their default values.
432-
// See https://spec.matrix.org/v1.1/client-server-api/#mroompower_levels for defaults.
432+
// See https://spec.matrix.org/v1.8/client-server-api/#mroompower_levels for defaults.
433433
func (c *PowerLevelContent) Defaults() {
434-
c.Invite = 50
434+
c.Invite = 0
435435
c.Ban = 50
436436
c.Kick = 50
437437
c.Redact = 50

0 commit comments

Comments
 (0)