Commit a517067
Changed files (1)
src
all-badges
public-keys
src/all-badges/public-keys/public-keys.ts
@@ -11,19 +11,20 @@ export default new (class implements BadgePresenter {
'public-keys-5',
] as const
present: Present = (data, grant) => {
- if (data.user.publicKeys.totalCount == 1) {
+ const count = data.user.publicKeys?.totalCount ?? 0
+ if (count == 1) {
grant('public-keys-1', 'I have one public key').tier(1)
}
- if (data.user.publicKeys.totalCount == 2) {
+ if (count == 2) {
grant('public-keys-2', 'I have two public keys').tier(2)
}
- if (data.user.publicKeys.totalCount == 3) {
+ if (count == 3) {
grant('public-keys-3', 'I have three public keys').tier(3)
}
- if (data.user.publicKeys.totalCount == 4) {
+ if (count == 4) {
grant('public-keys-4', 'I have four public keys').tier(4)
}
- if (data.user.publicKeys.totalCount >= 5) {
+ if (count >= 5) {
grant('public-keys-5', 'I have five or more public keys').tier(5)
}
}