1
0
mirror of https://github.com/mailvelope/keyserver.git synced 2026-10-24 08:19:18 +03:00

Fix key removal for ferretdb compat

This commit is contained in:
Pirate Praveen
2024-05-24 19:23:27 +05:30
parent 4deb32c84d
commit 4e8f0761fc

View File

@@ -345,7 +345,19 @@ class PublicKey {
// flag only the provided user id
if (email) {
const nonce = util.random();
await this._mongo.update(query, {'userIds.$.nonce': nonce}, DB_TYPE);
const flaggedUserIds = key.userIds.map(uid => {
if (uid.email === email) {
return {
nonce: nonce,
verified: uid.verified,
publicKeyArmored: uid.publicKeyArmored,
name: uid.name,
email: uid.email
}
}
return uid;
});
await this._mongo.update({'_id':key['_id']}, {userIds: flaggedUserIds}, DB_TYPE);
const uid = key.userIds.find(u => u.email === email);
uid.nonce = nonce;
return {userIds: [uid], keyId: key.keyId};