From 92a6fcc37909f2227937d820f809415dec0b65ad Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Tue, 11 Apr 2017 10:46:14 +0200 Subject: [PATCH] [fix] Keep only last cert, if many from the same pubkey - fix #436 --- www/js/services/wot-services.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index a324c28ed..9fda01d13 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -191,12 +191,13 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic certPubkeys[cert.pubkey] = result; } else { // if duplicated cert: keep the most recent - if (result.block > certPubkeys[cert.pubkey].block) { + if (result.cert_time.block > certPubkeys[cert.pubkey].cert_time.block) { certPubkeys[cert.pubkey] = result; - // TODO : to not add, but replace the old one + certs.splice(_.findIndex(certs, {pubkey: cert.pubkey}), 1, result); + return certs; } else { - return certs; // skip this result + return certs; // skip this cert } } return certs.concat(result); -- GitLab