aboutsummaryrefslogtreecommitdiff
path: root/clientapi
diff options
context:
space:
mode:
Diffstat (limited to 'clientapi')
-rw-r--r--clientapi/routing/createroom.go19
1 files changed, 14 insertions, 5 deletions
diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go
index af43064f..9655339c 100644
--- a/clientapi/routing/createroom.go
+++ b/clientapi/routing/createroom.go
@@ -339,12 +339,21 @@ func createRoom(
util.GetLogger(req.Context()).WithError(err).Error("authEvents.AddEvent failed")
return jsonerror.InternalServerError()
}
- }
- // send events to the room server
- if err = roomserverAPI.SendEvents(req.Context(), rsAPI, builtEvents, cfg.Matrix.ServerName, nil); err != nil {
- util.GetLogger(req.Context()).WithError(err).Error("SendEvents failed")
- return jsonerror.InternalServerError()
+ accumulated := gomatrixserverlib.UnwrapEventHeaders(builtEvents)
+ if err = roomserverAPI.SendEventWithState(
+ req.Context(),
+ rsAPI,
+ &gomatrixserverlib.RespState{
+ StateEvents: accumulated,
+ AuthEvents: accumulated,
+ },
+ ev.Headered(roomVersion),
+ nil,
+ ); err != nil {
+ util.GetLogger(req.Context()).WithError(err).Error("SendEventWithState failed")
+ return jsonerror.InternalServerError()
+ }
}
// TODO(#269): Reserve room alias while we create the room. This stops us