From be632a3487fb7901aa766d5139da3700a1a12505 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Tue, 2 May 2023 12:10:26 +0100 Subject: [PATCH] Fix UserID.String() --- relayapi/internal/perform.go | 8 ++++---- relayapi/routing/relaytxn.go | 2 +- relayapi/routing/relaytxn_test.go | 2 +- relayapi/routing/sendrelay.go | 2 +- relayapi/routing/sendrelay_test.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/relayapi/internal/perform.go b/relayapi/internal/perform.go index 79d600abf..457652112 100644 --- a/relayapi/internal/perform.go +++ b/relayapi/internal/perform.go @@ -101,11 +101,11 @@ func (r *RelayInternalAPI) QueryTransactions( userID spec.UserID, previousEntry fclient.RelayEntry, ) (api.QueryRelayTransactionsResponse, error) { - logrus.Infof("QueryTransactions for %s", userID.String()) + logrus.Infof("QueryTransactions for %s", userID.Raw()) if previousEntry.EntryID > 0 { logrus.Infof("Cleaning previous entry (%v) from db for %s", previousEntry.EntryID, - userID.String(), + userID.Raw(), ) prevReceipt := receipt.NewReceipt(previousEntry.EntryID) err := r.db.CleanTransactions(ctx, userID, []*receipt.Receipt{&prevReceipt}) @@ -123,12 +123,12 @@ func (r *RelayInternalAPI) QueryTransactions( response := api.QueryRelayTransactionsResponse{} if transaction != nil && receipt != nil { - logrus.Infof("Obtained transaction (%v) for %s", transaction.TransactionID, userID.String()) + logrus.Infof("Obtained transaction (%v) for %s", transaction.TransactionID, userID.Raw()) response.Transaction = *transaction response.EntryID = receipt.GetNID() response.EntriesQueued = true } else { - logrus.Infof("No more entries in the queue for %s", userID.String()) + logrus.Infof("No more entries in the queue for %s", userID.Raw()) response.EntryID = 0 response.EntriesQueued = false } diff --git a/relayapi/routing/relaytxn.go b/relayapi/routing/relaytxn.go index 9a3ced529..2fc61373a 100644 --- a/relayapi/routing/relaytxn.go +++ b/relayapi/routing/relaytxn.go @@ -34,7 +34,7 @@ func GetTransactionFromRelay( relayAPI api.RelayInternalAPI, userID spec.UserID, ) util.JSONResponse { - logrus.Infof("Processing relay_txn for %s", userID.String()) + logrus.Infof("Processing relay_txn for %s", userID.Raw()) var previousEntry fclient.RelayEntry if err := json.Unmarshal(fedReq.Content(), &previousEntry); err != nil { diff --git a/relayapi/routing/relaytxn_test.go b/relayapi/routing/relaytxn_test.go index 1041d8e7e..e6d2d9e5d 100644 --- a/relayapi/routing/relaytxn_test.go +++ b/relayapi/routing/relaytxn_test.go @@ -35,7 +35,7 @@ func createQuery( prevEntry fclient.RelayEntry, ) fclient.FederationRequest { var federationPathPrefixV1 = "/_matrix/federation/v1" - path := federationPathPrefixV1 + "/relay_txn/" + userID.String() + path := federationPathPrefixV1 + "/relay_txn/" + userID.Raw() request := fclient.NewFederationRequest("GET", userID.Domain(), "relay", path) request.SetContent(prevEntry) diff --git a/relayapi/routing/sendrelay.go b/relayapi/routing/sendrelay.go index 6ff08e205..e4794dc4d 100644 --- a/relayapi/routing/sendrelay.go +++ b/relayapi/routing/sendrelay.go @@ -36,7 +36,7 @@ func SendTransactionToRelay( txnID gomatrixserverlib.TransactionID, userID spec.UserID, ) util.JSONResponse { - logrus.Infof("Processing send_relay for %s", userID.String()) + logrus.Infof("Processing send_relay for %s", userID.Raw()) var txnEvents fclient.RelayEvents if err := json.Unmarshal(fedReq.Content(), &txnEvents); err != nil { diff --git a/relayapi/routing/sendrelay_test.go b/relayapi/routing/sendrelay_test.go index cac109e19..05dfbe6d1 100644 --- a/relayapi/routing/sendrelay_test.go +++ b/relayapi/routing/sendrelay_test.go @@ -52,7 +52,7 @@ func createFederationRequest( content interface{}, ) fclient.FederationRequest { var federationPathPrefixV1 = "/_matrix/federation/v1" - path := federationPathPrefixV1 + "/send_relay/" + string(txnID) + "/" + userID.String() + path := federationPathPrefixV1 + "/send_relay/" + string(txnID) + "/" + userID.Raw() request := fclient.NewFederationRequest("PUT", origin, destination, path) request.SetContent(content)