Prefer a non-revoked primary user
This commit is contained in:
parent
c7339f6f78
commit
3c0b22268d
|
@ -560,7 +560,7 @@ Key.prototype.getPrimaryUser = async function(date=new Date(), userId={}) {
|
||||||
const primaryUser = users.sort(function(a, b) {
|
const primaryUser = users.sort(function(a, b) {
|
||||||
const A = a.selfCertification;
|
const A = a.selfCertification;
|
||||||
const B = b.selfCertification;
|
const B = b.selfCertification;
|
||||||
return A.isPrimaryUserID - B.isPrimaryUserID || A.created - B.created;
|
return B.revoked - A.revoked || A.isPrimaryUserID - B.isPrimaryUserID || A.created - B.created;
|
||||||
}).pop();
|
}).pop();
|
||||||
const { user, selfCertification: cert } = primaryUser;
|
const { user, selfCertification: cert } = primaryUser;
|
||||||
if (cert.revoked || await user.isRevoked(primaryKey, cert, null, date)) {
|
if (cert.revoked || await user.isRevoked(primaryKey, cert, null, date)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user