aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/leave.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-03 17:24:51 +0100
committerGitHub <noreply@github.com>2020-07-03 17:24:51 +0100
commitea9df46c70a1b806c11198a1272aac99dc8b62f4 (patch)
treea2851f4702bbd58dd8fc9c3ba614bd8a61a8a227 /federationapi/routing/leave.go
parent46dbc46f84a7120bb418ec48ddc1d6248ef97979 (diff)
Implement local redaction (#1182)
* Create redaction events and apply checks (but do not send them) * Send redactions to the roomserver * Linting * Slightly better wording
Diffstat (limited to 'federationapi/routing/leave.go')
-rw-r--r--federationapi/routing/leave.go13
1 files changed, 2 insertions, 11 deletions
diff --git a/federationapi/routing/leave.go b/federationapi/routing/leave.go
index 108fc50a..56f1b05a 100644
--- a/federationapi/routing/leave.go
+++ b/federationapi/routing/leave.go
@@ -32,15 +32,6 @@ 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{
@@ -91,7 +82,7 @@ func MakeLeave(
stateEvents[i] = &queryRes.StateEvents[i].Event
}
provider := gomatrixserverlib.NewAuthEvents(stateEvents)
- if err = gomatrixserverlib.Allowed(*event, &provider); err != nil {
+ if err = gomatrixserverlib.Allowed(event.Event, &provider); err != nil {
return util.JSONResponse{
Code: http.StatusForbidden,
JSON: jsonerror.Forbidden(err.Error()),
@@ -101,7 +92,7 @@ func MakeLeave(
return util.JSONResponse{
Code: http.StatusOK,
JSON: map[string]interface{}{
- "room_version": verRes.RoomVersion,
+ "room_version": event.RoomVersion,
"event": builder,
},
}