From b93a9e46150d080dc0e5dfd12351529710599a5a Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Wed, 5 Jul 2023 11:01:12 +0200 Subject: [PATCH] Remove unused method --- internal/transactionrequest.go | 41 ---------------------------------- 1 file changed, 41 deletions(-) diff --git a/internal/transactionrequest.go b/internal/transactionrequest.go index 121c72138..7197323be 100644 --- a/internal/transactionrequest.go +++ b/internal/transactionrequest.go @@ -209,47 +209,6 @@ func (t *TxnReq) ProcessTransaction(ctx context.Context) (*fclient.RespSend, *ut return &fclient.RespSend{PDUs: results}, nil } -// updateUnsignedIfNeeded sets unsigned.prev_content to the previous membership event. This is -// to avoid checking the mxid_mapping on join -> join (e.g. displayname changes) events, which -// wouldn't be present. -func (t *TxnReq) updateUnsignedIfNeeded(ctx context.Context, event gomatrixserverlib.PDU) (updated bool, err error) { - var membership string - membership, err = event.Membership() - if err != nil { - return false, err - } - var validRoomID *spec.RoomID - validRoomID, err = spec.NewRoomID(event.RoomID()) - if err != nil { - return false, err - } - - // get the current membership event - var currentStateEv gomatrixserverlib.PDU - currentStateEv, err = t.rsAPI.CurrentStateEvent(ctx, *validRoomID, event.Type(), string(event.SenderID())) - if err != nil { - return false, err - } - if currentStateEv != nil { - var currentMembership string - currentMembership, err = currentStateEv.Membership() - if err != nil { - return false, err - } - - // if the currentMembership is join and the new membership as well (e.g. displayname change), - // update unsigned so VerifyEventSignatures does not try to validate the mxid_mapping - if currentMembership == spec.Join && currentMembership == membership { - err = event.SetUnsignedField("prev_content", currentStateEv.Content()) - if err != nil { - return false, err - } - return true, nil - } - } - return false, nil -} - // nolint:gocyclo func (t *TxnReq) processEDUs(ctx context.Context) { for _, e := range t.EDUs {