Don't send read receipts for fake JIDs

This commit is contained in:
Tulir Asokan 2021-12-16 10:35:52 +02:00
parent c2520c14db
commit 0d977bc610

View file

@ -2278,8 +2278,10 @@ func (portal *Portal) HandleMatrixReadReceipt(sender *User, eventID id.EventID,
} }
groupedMessages := make(map[types.JID][]types.MessageID) groupedMessages := make(map[types.JID][]types.MessageID)
for _, msg := range messages { for _, msg := range messages {
if !msg.IsFakeJID() {
groupedMessages[msg.Sender] = append(groupedMessages[msg.Sender], msg.JID) groupedMessages[msg.Sender] = append(groupedMessages[msg.Sender], msg.JID)
} }
}
portal.log.Debugfln("Sending read receipts by %s: %v", sender.JID, groupedMessages) portal.log.Debugfln("Sending read receipts by %s: %v", sender.JID, groupedMessages)
for messageSender, ids := range groupedMessages { for messageSender, ids := range groupedMessages {
err := sender.Client.MarkRead(ids, receiptTimestamp, portal.Key.JID, messageSender) err := sender.Client.MarkRead(ids, receiptTimestamp, portal.Key.JID, messageSender)