Send cumulative state when creating room (#1519)

* Send state with new room events

* lookupEvent sends outliers

* Revert "lookupEvent sends outliers"

This reverts commit 3e1655644105a542b806e28d6d2536fbd23ecc83.
This commit is contained in:
Neil Alexander 2020-10-14 09:57:27 +01:00 committed by GitHub
parent 9d6b77c58a
commit 20aec70ead
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -339,13 +339,22 @@ func createRoom(
util.GetLogger(req.Context()).WithError(err).Error("authEvents.AddEvent failed") util.GetLogger(req.Context()).WithError(err).Error("authEvents.AddEvent failed")
return jsonerror.InternalServerError() return jsonerror.InternalServerError()
} }
}
// send events to the room server accumulated := gomatrixserverlib.UnwrapEventHeaders(builtEvents)
if err = roomserverAPI.SendEvents(req.Context(), rsAPI, builtEvents, cfg.Matrix.ServerName, nil); err != nil { if err = roomserverAPI.SendEventWithState(
util.GetLogger(req.Context()).WithError(err).Error("SendEvents failed") 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() return jsonerror.InternalServerError()
} }
}
// TODO(#269): Reserve room alias while we create the room. This stops us // TODO(#269): Reserve room alias while we create the room. This stops us
// from creating the room but still failing due to the alias having already // from creating the room but still failing due to the alias having already