(badgeId: string)
| 695 | }; |
| 696 | |
| 697 | const tryAward = async (badgeId: string) => { |
| 698 | const isNew = await this.awardBadge(userId, badgeId); |
| 699 | if (isNew) { |
| 700 | awarded.push(badgeId); |
| 701 | // Lazy-import to avoid circular dependencies |
| 702 | const { notifyUser } = await import('../notifications/notification-service.js'); |
| 703 | notifyUser({ |
| 704 | recipientUserId: userId, |
| 705 | type: 'badge_earned', |
| 706 | referenceId: badgeId, |
| 707 | referenceType: 'badge', |
| 708 | title: `You earned the "${BADGE_LABELS[badgeId] || badgeId}" badge`, |
| 709 | url: '/community', |
| 710 | }).catch(err => logger.error({ err }, 'Failed to send badge notification')); |
| 711 | } |
| 712 | }; |
| 713 | |
| 714 | if (context === 'connection') { |
| 715 | const count = await this.getConnectionCount(userId); |
nothing calls this directly
no test coverage detected