Fix badges not showing up (#6730)

* Fix badges not showing up

* Always fetch meta data first [badges]
This commit is contained in:
Nicolas Gotchac 2017-10-12 22:17:59 +02:00 committed by Jaco Greeff
parent 7472bc3570
commit 78146e903d

View File

@ -206,7 +206,7 @@ export default class CertifiersMonitor {
// Fetch the address, name and owner in one batch
return querier(this.api, { address: instance.address, from, limit }, instance.badge)
.then((results) => {
this.certifiers = results
const certifiers = results
.map(([ address, name, owner ], index) => ({
address, owner,
id: index + from,
@ -225,7 +225,7 @@ export default class CertifiersMonitor {
}, {});
// Fetch the meta-data in serie
return Object.values(this.certifiers).reduce((promise, certifier) => {
return Object.values(certifiers).reduce((promise, certifier) => {
return promise.then(() => badgeReg.fetchMeta(certifier.id))
.then((meta) => {
this.certifiers[certifier.id] = { ...certifier, ...meta };
@ -274,8 +274,6 @@ export default class CertifiersMonitor {
.then((certified) => {
const { id, title, icon, name } = certifier;
this.fetchedAccounts[address] = true;
if (!certified) {
return this.store.dispatch(removeCertification(address, id));
}
@ -283,7 +281,10 @@ export default class CertifiersMonitor {
log.debug('seen as certified', { address, id, name, icon });
this.store.dispatch(addCertification(address, id, name, title, icon));
});
}, Promise.resolve());
}, Promise.resolve())
.then(() => {
this.fetchedAccounts[address] = true;
});
}
setCertifiersFilter () {