From 3a5c8256df1e5d47294e8d46333f5848bb881275 Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Tue, 20 Oct 2020 09:23:23 +0200 Subject: [PATCH] Use key/value directly --- federationapi/routing/send.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go index 9e0ed7294..79fbcb3d4 100644 --- a/federationapi/routing/send.go +++ b/federationapi/routing/send.go @@ -332,7 +332,7 @@ func (t *txnReq) processEDUs(ctx context.Context) { } for roomID, receipt := range payload { - for userID := range receipt.User { + for userID, mread := range receipt.User { _, domain, err := gomatrixserverlib.SplitID('@', userID) if err != nil { util.GetLogger(ctx).WithError(err).Error("Failed to split domain from receipt event sender") @@ -342,14 +342,12 @@ func (t *txnReq) processEDUs(ctx context.Context) { util.GetLogger(ctx).Warnf("Dropping receipt event where sender domain (%q) doesn't match origin (%q)", domain, t.Origin) continue } - ts := receipt.User[userID].Data.TS - events := receipt.User[userID].EventIDs - if err := t.processReceiptEvent(ctx, userID, roomID, "m.read", ts, events); err != nil { + if err := t.processReceiptEvent(ctx, userID, roomID, "m.read", mread.Data.TS, mread.EventIDs); err != nil { util.GetLogger(ctx).WithError(err).WithFields(logrus.Fields{ "sender": t.Origin, "user_id": userID, "room_id": roomID, - "events": receipt.User[userID].EventIDs, + "events": mread.EventIDs, }).Error("Failed to send receipt event to edu server") continue }