Ignore read receipts pointing at old messages
This commit is contained in:
parent
473c9d59f9
commit
914e4ea280
1 changed files with 4 additions and 1 deletions
5
user.go
5
user.go
|
@ -1173,8 +1173,11 @@ func (user *User) markSelfReadFull(ctx context.Context, portal *Portal, lastMess
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
lastMessage, err := user.bridge.DB.Message.GetByID(ctx, portal.Receiver, lastMessageID)
|
lastMessage, err := user.bridge.DB.Message.GetByID(ctx, portal.Receiver, lastMessageID)
|
||||||
if err == nil && lastMessage == nil || lastMessage.IsFakeMXID() {
|
if err == nil && (lastMessage == nil || lastMessage.IsFakeMXID()) {
|
||||||
lastMessage, err = user.bridge.DB.Message.GetLastInChatWithMXID(ctx, portal.Key)
|
lastMessage, err = user.bridge.DB.Message.GetLastInChatWithMXID(ctx, portal.Key)
|
||||||
|
if idToInt(lastMessage.ID) > idToInt(lastMessageID) {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
user.zlog.Warn().Err(err).Msg("Failed to get last message in chat to mark it as read")
|
user.zlog.Warn().Err(err).Msg("Failed to get last message in chat to mark it as read")
|
||||||
|
|
Loading…
Reference in a new issue