mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-16 01:12:05 +01:00
Only keep most recent signatures for datum in CertificationSet
This commit is contained in:
parent
f77522e42f
commit
e478d146ad
1 changed files with 13 additions and 1 deletions
|
@ -77,6 +77,7 @@ class CertificationSet(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a single [Certification] into this objects [certifications].
|
* Add a single [Certification] into this objects [certifications].
|
||||||
|
* If there are already some [Cer]
|
||||||
*
|
*
|
||||||
* @param certification [Certification] with the same issuer fingerprint and target fingerprint as this object.
|
* @param certification [Certification] with the same issuer fingerprint and target fingerprint as this object.
|
||||||
*/
|
*/
|
||||||
|
@ -89,7 +90,18 @@ class CertificationSet(
|
||||||
certificationsForUserId = ArrayList()
|
certificationsForUserId = ArrayList()
|
||||||
_certifications[certification.userId] = certificationsForUserId
|
_certifications[certification.userId] = certificationsForUserId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (certificationsForUserId.isEmpty()) {
|
||||||
certificationsForUserId.add(certification)
|
certificationsForUserId.add(certification)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val existing = certificationsForUserId[0]
|
||||||
|
if (existing.creationTime.before(certification.creationTime)) {
|
||||||
|
certificationsForUserId.clear() // throw away older certifications
|
||||||
|
certificationsForUserId.add(certification)
|
||||||
|
}
|
||||||
|
// else this certification is older, so ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
|
|
Loading…
Reference in a new issue