diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-08-16 11:55:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-16 11:55:06 +0100 |
commit | 5424b88f3061dddbeae53df8b67bd064e8cbc400 (patch) | |
tree | 992c0b4190c5b87a97b8af60dcdfd9ff5dfe1457 /clientapi | |
parent | 0642ffc0f6c6d21af0e4a17acd84200e35bf279a (diff) |
Use `is_direct` flag from `/createRoom`, update stripped state (#2644)
* Use `is_direct` flag from `/createRoom`, update stripped state
* Add comment
Diffstat (limited to 'clientapi')
-rw-r--r-- | clientapi/routing/createroom.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go index 87490863..3e837c86 100644 --- a/clientapi/routing/createroom.go +++ b/clientapi/routing/createroom.go @@ -49,6 +49,7 @@ type createRoomRequest struct { GuestCanJoin bool `json:"guest_can_join"` RoomVersion gomatrixserverlib.RoomVersion `json:"room_version"` PowerLevelContentOverride json.RawMessage `json:"power_level_content_override"` + IsDirect bool `json:"is_direct"` } const ( @@ -499,9 +500,17 @@ func createRoom( // Build some stripped state for the invite. var globalStrippedState []gomatrixserverlib.InviteV2StrippedState for _, event := range builtEvents { + // Chosen events from the spec: + // https://spec.matrix.org/v1.3/client-server-api/#stripped-state switch event.Type() { + case gomatrixserverlib.MRoomCreate: + fallthrough case gomatrixserverlib.MRoomName: fallthrough + case gomatrixserverlib.MRoomAvatar: + fallthrough + case gomatrixserverlib.MRoomTopic: + fallthrough case gomatrixserverlib.MRoomCanonicalAlias: fallthrough case gomatrixserverlib.MRoomEncryption: @@ -522,7 +531,7 @@ func createRoom( // Build the invite event. inviteEvent, err := buildMembershipEvent( ctx, invitee, "", profileAPI, device, gomatrixserverlib.Invite, - roomID, true, cfg, evTime, rsAPI, asAPI, + roomID, r.IsDirect, cfg, evTime, rsAPI, asAPI, ) if err != nil { util.GetLogger(ctx).WithError(err).Error("buildMembershipEvent failed") |