Roomserver perform leave (#1004)

* First pass at PerformLeave

* Fix SQLite bulkSelectEventStateKey

* Update gomatrixserverlib

* Fix bugs

* Tidy a bit

* Satisfy King Linter

* Review comments

* Review comments

* Fix constants in SQLite event state keys table
This commit is contained in:
Neil Alexander 2020-05-04 18:34:09 +01:00 committed by GitHub
parent df80e42408
commit 9b1b095b49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 394 additions and 14 deletions

View file

@ -33,6 +33,15 @@ func MakeLeave(
rsAPI api.RoomserverInternalAPI,
roomID, userID string,
) util.JSONResponse {
verReq := api.QueryRoomVersionForRoomRequest{RoomID: roomID}
verRes := api.QueryRoomVersionForRoomResponse{}
if err := rsAPI.QueryRoomVersionForRoom(httpReq.Context(), &verReq, &verRes); err != nil {
return util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: jsonerror.InternalServerError(),
}
}
_, domain, err := gomatrixserverlib.SplitID('@', userID)
if err != nil {
return util.JSONResponse{
@ -87,7 +96,10 @@ func MakeLeave(
return util.JSONResponse{
Code: http.StatusOK,
JSON: map[string]interface{}{"event": builder},
JSON: map[string]interface{}{
"room_version": verRes.RoomVersion,
"event": builder,
},
}
}