fix(issuer): refresh badge count after award/revoke#2018
Merged
Conversation
9f5e452 to
fe7aa5d
Compare
|
Hi @fatimakay, great fix! Two small suggestions:
this.badgesLoaded = this.badgeClassService.badgesList
.updateList()
.then(() => firstValueFrom(this.badgeClassService.badgesByIssuerUrl$))
.then((badgesByIssuer) => {
const cmp = (a, b) => (a === b ? 0 : a < b ? -1 : 1);
this.badges = (badgesByIssuer[this.issuer.issuerUrl] || []).sort((a, b) =>
cmp(b.createdAt, a.createdAt),
);
})
.catch((error) => {
this.messageService.reportAndThrowError(
`Failed to load badges for ${this.issuer ? this.issuer.name : this.issuerSlug}`,
error,
);
});
export class BadgeResult {
constructor(
public badge: BadgeClass | PublicApiBadgeClass,
public issuerName: string,
public requestCount: number,
private _awardedCount?: number,
) {}
get awardedCount(): number {
if (this._awardedCount !== undefined) return this._awardedCount;
return this.badge instanceof BadgeClass ? this.badge.recipientCount : 0;
}
} |
Author
|
Hi @onemanwenttomow, thank you for reviewing. just updated the PR with your suggested changes! |
454ddac to
8e293f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Issue #2017