Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Backport stable #6730 - Fixes Badges (#6731)
Browse files Browse the repository at this point in the history
* Fix badges not showing up

* Always fetch meta data first [badges]
  • Loading branch information
ngotchac authored and jacogr committed Oct 12, 2017
1 parent 75b4bea commit 148b209
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions js/src/redux/providers/certifications/certifiers.monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 };
Expand Down Expand Up @@ -274,16 +274,17 @@ 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));
}

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 () {
Expand Down

0 comments on commit 148b209

Please sign in to comment.