mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
fix up replace keys check
This commit is contained in:
parent
3e01a88a0c
commit
5290d3fe76
1 changed files with 4 additions and 6 deletions
|
@ -72,13 +72,11 @@ func (a *KeyBackupSession) ShouldReplaceRoomKey(newKey *KeyBackupSession) bool {
|
||||||
// "if the keys have different values for is_verified, then it will keep the key that has is_verified set to true"
|
// "if the keys have different values for is_verified, then it will keep the key that has is_verified set to true"
|
||||||
if newKey.IsVerified && !a.IsVerified {
|
if newKey.IsVerified && !a.IsVerified {
|
||||||
return true
|
return true
|
||||||
}
|
} else if newKey.FirstMessageIndex < a.FirstMessageIndex {
|
||||||
// "if they have the same values for is_verified, then it will keep the key with a lower first_message_index"
|
// "if they have the same values for is_verified, then it will keep the key with a lower first_message_index"
|
||||||
if newKey.FirstMessageIndex < a.FirstMessageIndex {
|
|
||||||
return true
|
return true
|
||||||
}
|
} else if newKey.ForwardedCount < a.ForwardedCount {
|
||||||
// "and finally, is is_verified and first_message_index are equal, then it will keep the key with a lower forwarded_count"
|
// "and finally, is is_verified and first_message_index are equal, then it will keep the key with a lower forwarded_count"
|
||||||
if newKey.ForwardedCount < a.ForwardedCount {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue