MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / tryAward

Method tryAward

server/src/db/community-db.ts:697–712  ·  view source on GitHub ↗
(badgeId: string)

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 2

awardBadgeMethod · 0.95
notifyUserFunction · 0.85

Tested by

no test coverage detected