feat: support for room v11#858
Conversation
| // The creator field was removed in room version 11 (MSC4239). | ||
| n, err := strconv.Atoi(string(roomVer)) | ||
| if err != nil || n < 11 { | ||
| content["creator"] = creator | ||
| } |
There was a problem hiding this comment.
Feels like something that should be handled by this kind of thing:
iRoomVer := gomatrixserverlib.MustGetRoomVersion(roomVer)
if iRoomVer.CreatorInCreateEvent() {
CreatorInCreateEvent doesn't exist yet but aligns with the other things we have there like DomainlessRoomIDs and PrivilegedCreators
See #840 for how v12 rooms were added
There was a problem hiding this comment.
that's a good idea! done, and also added a change there matrix-org/gomatrixserverlib#465
Signed-off-by: Thomas Traineau t.traineau@famedly.com
6af47bf to
1feb361
Compare
| ver := alice.GetDefaultRoomVersion(t) | ||
| // This test crafts a "bad" event which state_key is 280 bytes but only 70 | ||
| // codepoints. | ||
| // | ||
| // Room version 11 in Synapse switched from using codepoints to using | ||
| // bytes. Which means the 280-byte state_key would be rejected immediately. | ||
| // Use room version 10 in that case so the codepoint-based limit is in effect. | ||
| // | ||
| // Since upgrading a room (for example from v10 to v11) won't carry the event | ||
| // (a new room is created), we don't have to worry about v10 room events in a v11 | ||
| // room. | ||
| // | ||
| // So this test is essentially skipped for any default room v11 or higher. | ||
| verNum, _ := strconv.Atoi(string(ver)) | ||
| if verNum >= 11 { | ||
| ver = gomatrixserverlib.RoomVersion("10") | ||
| } |
There was a problem hiding this comment.
Seems like this test would be better if we just always used room version 10 🤔 . The current setup is only better if we're trying to support homeservers that don't support room version 10 yet (do we care about that?)
| ver := alice.GetDefaultRoomVersion(t) | |
| // This test crafts a "bad" event which state_key is 280 bytes but only 70 | |
| // codepoints. | |
| // | |
| // Room version 11 in Synapse switched from using codepoints to using | |
| // bytes. Which means the 280-byte state_key would be rejected immediately. | |
| // Use room version 10 in that case so the codepoint-based limit is in effect. | |
| // | |
| // Since upgrading a room (for example from v10 to v11) won't carry the event | |
| // (a new room is created), we don't have to worry about v10 room events in a v11 | |
| // room. | |
| // | |
| // So this test is essentially skipped for any default room v11 or higher. | |
| verNum, _ := strconv.Atoi(string(ver)) | |
| if verNum >= 11 { | |
| ver = gomatrixserverlib.RoomVersion("10") | |
| } | |
| // This test crafts a "bad" event which state_key is 280 bytes but only 70 | |
| // codepoints. | |
| // | |
| // Room version 11 in Synapse switched from using codepoints to using | |
| // bytes. Which means the 280-byte state_key would be rejected immediately. | |
| // Use room version 10 in that case so the codepoint-based limit is in effect. | |
| // | |
| // Since upgrading a room (for example from v10 to v11) won't carry the event | |
| // (a new room is created), we don't have to worry about v10 room events in a v11 | |
| // room. | |
| // | |
| // So this test is essentially skipped for any default room v11 or higher. | |
| ver = gomatrixserverlib.RoomVersion("10") |
There was a problem hiding this comment.
yea I thought it's better to be flexible (since it's not a big change in the test code), but I can apply your suggestion if you think it's better
There was a problem hiding this comment.
Probably simplest to converge on room version 10.
If there is a use case for the alternative, we can go that route but the comment should better explain the intention.
MadLittleMods
left a comment
There was a problem hiding this comment.
Changes look good 👍
(waiting for matrix-org/gomatrixserverlib#465 to merge)
related to matrix-org/complement#858 ### 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: `Thomas Traineau <t.traineau@famedly.com>` --------- Signed-off-by: Thomas Traineau t.traineau@famedly.com
|
@MadLittleMods the gomatrixserverlib PR has been merged, I guess this PR can be merged now? :) |
Co-authored-by: Eric Eastwood <madlittlemods@gmail.com>
|
Thanks for the improvements and getting the |
creatorfield anymore during room creation, which broke the tests.state_keylength in events (from codepoints to bytes) at room v11, which broke the tests.This PR fixes those issues, making complement work with room v11 as default.
Related to element-hq/synapse#18680