Fix handling read receipts where target is unknown

This commit is contained in:
Tulir Asokan 2021-12-01 14:15:39 +02:00
parent a909750dcc
commit c55cad980d

View file

@ -748,7 +748,11 @@ func (user *User) handleReceipt(receipt *events.Receipt) {
}
}
if receipt.Sender.User == user.JID.User {
user.SetLastReadTS(portal.Key, markAsRead[0].Timestamp)
if len(markAsRead) > 0 {
user.SetLastReadTS(portal.Key, markAsRead[0].Timestamp)
} else {
user.SetLastReadTS(portal.Key, receipt.Timestamp)
}
}
intent := user.bridge.GetPuppetByJID(receipt.Sender).IntentFor(portal)
for _, msg := range markAsRead {