Skip to content

Commit

Permalink
Revert "Send event using the PDU, not just e. Add a log event so we c…
Browse files Browse the repository at this point in the history
…an see when it is sent"

This reverts commit 4c55d53.
  • Loading branch information
rcarback committed Dec 3, 2024
1 parent 8dd5e50 commit 253d7a9
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions clientapi/routing/redaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ 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"
Expand All @@ -41,13 +40,6 @@ 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{
Expand Down Expand Up @@ -183,20 +175,14 @@ func SendRedaction(
}
}
domain := device.UserDomain()
if err = roomserverAPI.SendEvents(context.Background(), rsAPI, roomserverAPI.KindNew, []*types.HeaderedEvent{{PDU: e.PDU}}, device.UserDomain(), domain, domain, nil, false); err != nil {
if err = roomserverAPI.SendEvents(context.Background(), rsAPI, roomserverAPI.KindNew, []*types.HeaderedEvent{e}, device.UserDomain(), domain, domain, nil, false); err != nil {
util.GetLogger(req.Context()).WithError(err).Errorf("failed to SendEvents")
return util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: spec.InternalServerError{},
}
}

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{
Expand Down

0 comments on commit 253d7a9

Please sign in to comment.