diff --git a/clientapi/routing/redaction.go b/clientapi/routing/redaction.go index 795b311b..b868d333 100644 --- a/clientapi/routing/redaction.go +++ b/clientapi/routing/redaction.go @@ -15,6 +15,7 @@ import ( "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" + "github.com/sirupsen/logrus" "github.com/element-hq/dendrite/clientapi/httputil" "github.com/element-hq/dendrite/internal/eventutil" @@ -40,6 +41,13 @@ func SendRedaction( txnID *string, txnCache *transactions.Cache, ) util.JSONResponse { + roomVersion, err := rsAPI.QueryRoomVersionForRoom(req.Context(), roomID) + if err != nil { + return util.JSONResponse{ + Code: http.StatusBadRequest, + JSON: spec.UnsupportedRoomVersion(err.Error()), + } + } deviceUserID, userIDErr := spec.NewUserID(device.UserID, true) if userIDErr != nil { return util.JSONResponse{ @@ -175,7 +183,7 @@ func SendRedaction( } } domain := device.UserDomain() - if err = roomserverAPI.SendEvents(context.Background(), rsAPI, roomserverAPI.KindNew, []*types.HeaderedEvent{e}, device.UserDomain(), domain, domain, nil, false); err != nil { + if err = roomserverAPI.SendEvents(context.Background(), rsAPI, roomserverAPI.KindNew, []*types.HeaderedEvent{{PDU: e.PDU}}, device.UserDomain(), domain, domain, nil, false); err != nil { util.GetLogger(req.Context()).WithError(err).Errorf("failed to SendEvents") return util.JSONResponse{ Code: http.StatusInternalServerError, @@ -183,6 +191,12 @@ func SendRedaction( } } + util.GetLogger(req.Context()).WithFields(logrus.Fields{ + "event_id": e.PDU.EventID(), + "room_id": roomID, + "room_version": roomVersion, + }).Info("Sent redaction to roomserver") + res := util.JSONResponse{ Code: 200, JSON: redactionResponse{