Fix Matrix read receipt handling too

This commit is contained in:
Tulir Asokan 2021-12-01 21:14:37 +02:00
parent 4bdb130d13
commit 7bb629d199

View file

@ -2204,7 +2204,9 @@ func (portal *Portal) HandleMatrixReadReceipt(sender *User, eventID id.EventID,
}
messages := portal.bridge.DB.Message.GetMessagesBetween(portal.Key, prevTimestamp, maxTimestamp)
sender.SetLastReadTS(portal.Key, messages[len(messages)-1].Timestamp)
if len(messages) > 0 {
sender.SetLastReadTS(portal.Key, messages[len(messages)-1].Timestamp)
}
groupedMessages := make(map[types.JID][]types.MessageID)
for _, msg := range messages {
groupedMessages[msg.Sender] = append(groupedMessages[msg.Sender], msg.JID)