Use key/value directly

This commit is contained in:
Till Faelligen 2020-10-20 09:23:23 +02:00
parent 80f346d70a
commit 3a5c8256df

View file

@ -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
}