fix date queries in autocrypt handling

This commit is contained in:
Vincent Breitmoser
2018-06-12 16:44:27 +02:00
parent 4f6852ccfc
commit 4967a49949
2 changed files with 16 additions and 11 deletions

View File

@@ -40,13 +40,13 @@ class AutocryptInteractor {
// 1. If the messages effective date is older than the peers[from-addr].autocrypt_timestamp value, then no changes are required, and the update process terminates.
Date lastSeenAutocrypt = autocryptPeerDao.getLastSeenKey(autocryptPeerId);
if (lastSeenAutocrypt != null && lastSeenAutocrypt.after(effectiveDate)) {
if (lastSeenAutocrypt != null && effectiveDate.compareTo(lastSeenAutocrypt) <= 0) {
return;
}
// 2. If the messages effective date is more recent than peers[from-addr].last_seen then set peers[from-addr].last_seen to the messages effective date.
Date lastSeen = autocryptPeerDao.getLastSeen(autocryptPeerId);
if (lastSeen == null || lastSeen.after(effectiveDate)) {
if (lastSeen == null || effectiveDate.after(lastSeen)) {
autocryptPeerDao.updateLastSeen(autocryptPeerId, effectiveDate);
}