From ea9df46c70a1b806c11198a1272aac99dc8b62f4 Mon Sep 17 00:00:00 2001 From: Kegsay Date: Fri, 3 Jul 2020 17:24:51 +0100 Subject: Implement local redaction (#1182) * Create redaction events and apply checks (but do not send them) * Send redactions to the roomserver * Linting * Slightly better wording --- federationapi/routing/leave.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'federationapi/routing/leave.go') 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, }, } -- cgit v1.2.3