diff options
author | Kegsay <kegan@matrix.org> | 2020-07-03 17:24:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 17:24:51 +0100 |
commit | ea9df46c70a1b806c11198a1272aac99dc8b62f4 (patch) | |
tree | a2851f4702bbd58dd8fc9c3ba614bd8a61a8a227 /federationapi | |
parent | 46dbc46f84a7120bb418ec48ddc1d6248ef97979 (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')
-rw-r--r-- | federationapi/routing/join.go | 2 | ||||
-rw-r--r-- | federationapi/routing/leave.go | 13 |
2 files changed, 3 insertions, 12 deletions
diff --git a/federationapi/routing/join.go b/federationapi/routing/join.go index 8dcd1533..17981f53 100644 --- a/federationapi/routing/join.go +++ b/federationapi/routing/join.go @@ -118,7 +118,7 @@ func MakeJoin( } 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()), 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, }, } |