From 2a07f09ef30697857c68e0de13cbf7cac36e3d6a Mon Sep 17 00:00:00 2001 From: jeevan6996 Date: Tue, 7 Apr 2026 08:14:01 +0100 Subject: [PATCH 1/3] fix: show flat for RHF peer-review bounty notifications --- components/Notification/NotificationItem.tsx | 8 ++++++-- .../Notification/lib/formatNotification.ts | 20 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/components/Notification/NotificationItem.tsx b/components/Notification/NotificationItem.tsx index b92c19e05..e54543a6d 100644 --- a/components/Notification/NotificationItem.tsx +++ b/components/Notification/NotificationItem.tsx @@ -5,6 +5,7 @@ import { formatNotificationMessage, getHubDetailsFromNotification, formatNavigationUrl, + getBountyForYouUsdOverride, getRSCAmountFromNotification, } from './lib/formatNotification'; import { Avatar } from '@/components/ui/Avatar'; @@ -32,6 +33,7 @@ export function NotificationItem({ notification }: NotificationItemProps) { const formattedNavigationUrl = formatNavigationUrl(notification); const hasNavigationUrl = !!formattedNavigationUrl && formattedNavigationUrl.trim() !== ''; const rscAmount = getRSCAmountFromNotification(notification); + const bountyUsdOverride = showUSD ? getBountyForYouUsdOverride(notification) : null; const hubDetails = getHubDetailsFromNotification(notification); @@ -83,10 +85,12 @@ export function NotificationItem({ notification }: NotificationItemProps) { )} - {rscAmount && ( + {(rscAmount || bountyUsdOverride !== null) && (
{ + return ( + notification.type === 'BOUNTY_FOR_YOU' && + notification.extra?.bounty_type?.toUpperCase() === 'REVIEW' + ); +}; + +export function getBountyForYouUsdOverride(notification: Notification): number | null { + if (isPeerReviewBountyNotification(notification)) { + return FOUNDATION_BOUNTY_FLAT_USD; + } + + return null; +} + /** * Transform ResearchHub URLs to relative paths and convert #comments to /conversation * Examples: @@ -303,7 +319,9 @@ export function formatNotificationMessage( const amount = notification.extra?.amount || '0'; const bountyType = notification.extra?.bounty_type || ''; const bountyTypeAction = getBountyTypeAction(bountyType); - const usdValue = formatUsdValue(amount, exchangeRate); + const usdAmount = getBountyForYouUsdOverride(notification); + const usdValue = + usdAmount !== null ? `$${usdAmount.toLocaleString()} USD` : formatUsdValue(amount, exchangeRate); return `Your expertise is needed! Earn ${usdValue} for ${bountyTypeAction} "${truncatedTitle}"`; } From dfde721dd361e9f244841e06fd8cfe6efb9e6b67 Mon Sep 17 00:00:00 2001 From: jeevan6996 Date: Thu, 9 Apr 2026 08:25:22 +0100 Subject: [PATCH 2/3] fix: keep bounty message and badge currency consistent --- components/Notification/NotificationItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Notification/NotificationItem.tsx b/components/Notification/NotificationItem.tsx index e54543a6d..b54841432 100644 --- a/components/Notification/NotificationItem.tsx +++ b/components/Notification/NotificationItem.tsx @@ -33,7 +33,7 @@ export function NotificationItem({ notification }: NotificationItemProps) { const formattedNavigationUrl = formatNavigationUrl(notification); const hasNavigationUrl = !!formattedNavigationUrl && formattedNavigationUrl.trim() !== ''; const rscAmount = getRSCAmountFromNotification(notification); - const bountyUsdOverride = showUSD ? getBountyForYouUsdOverride(notification) : null; + const bountyUsdOverride = getBountyForYouUsdOverride(notification); const hubDetails = getHubDetailsFromNotification(notification); From 3034936494f9b342f878522bef80d43972d81e5d Mon Sep 17 00:00:00 2001 From: jeevan6996 Date: Sat, 27 Jun 2026 11:41:31 +0100 Subject: [PATCH 3/3] fix: limit peer review bounty override to foundation --- .../Notification/lib/formatNotification.ts | 17 ++++++++++++----- types/notification.ts | 4 ++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/components/Notification/lib/formatNotification.ts b/components/Notification/lib/formatNotification.ts index 873df5e5d..9786b05c6 100644 --- a/components/Notification/lib/formatNotification.ts +++ b/components/Notification/lib/formatNotification.ts @@ -1,5 +1,5 @@ import { type IconName } from '@/components/ui/icons/Icon'; -import { FOUNDATION_BOUNTY_FLAT_USD } from '@/config/constants'; +import { FOUNDATION_BOUNTY_FLAT_USD, FOUNDATION_USER_ID } from '@/config/constants'; import { Notification } from '@/types/notification'; import { formatUsdValue, formatRSC } from '@/utils/number'; @@ -196,15 +196,20 @@ export function getRSCAmountFromNotification(notification: Notification): number return null; } -const isPeerReviewBountyNotification = (notification: Notification): boolean => { +const isFoundationPeerReviewBountyNotification = (notification: Notification): boolean => { + const bountyCreatorId = notification.extra?.bountyCreatorId; + return ( notification.type === 'BOUNTY_FOR_YOU' && - notification.extra?.bounty_type?.toUpperCase() === 'REVIEW' + notification.extra?.bounty_type?.toUpperCase() === 'REVIEW' && + FOUNDATION_USER_ID !== null && + bountyCreatorId !== undefined && + bountyCreatorId.toString() === FOUNDATION_USER_ID.toString() ); }; export function getBountyForYouUsdOverride(notification: Notification): number | null { - if (isPeerReviewBountyNotification(notification)) { + if (isFoundationPeerReviewBountyNotification(notification)) { return FOUNDATION_BOUNTY_FLAT_USD; } @@ -331,7 +336,9 @@ export function formatNotificationMessage( const bountyTypeAction = getBountyTypeAction(bountyType); const usdAmount = getBountyForYouUsdOverride(notification); const usdValue = - usdAmount !== null ? `$${usdAmount.toLocaleString()} USD` : formatUsdValue(amount, exchangeRate); + usdAmount !== null + ? `$${usdAmount.toLocaleString()} USD` + : formatUsdValue(amount, exchangeRate); return `Your expertise is needed! Earn ${usdValue} for ${bountyTypeAction} "${truncatedTitle}"`; } diff --git a/types/notification.ts b/types/notification.ts index a054efca9..c0808575e 100644 --- a/types/notification.ts +++ b/types/notification.ts @@ -14,11 +14,13 @@ export interface NotificationHub { export interface NotificationExtra { amount?: string; bounty_id?: string; + bounty_creator_id?: string | number; bounty_type?: string; bounty_expiration_date?: string; hub_details?: string; user_hub_score?: string; rewardId?: string; + bountyCreatorId?: string | number; rewardType?: 'REVIEW' | 'CONTRIBUTION' | 'DISCUSSION'; hub?: NotificationHub; userHubScore?: string; @@ -76,11 +78,13 @@ const transformNotificationExtraRaw = (raw: any): NotificationExtra | undefined return { amount: raw.amount, bounty_id: raw.bounty_id, + bounty_creator_id: raw.bounty_creator_id ?? raw.bountyCreatorId, bounty_type: raw.bounty_type, bounty_expiration_date: raw.bounty_expiration_date, hub, user_hub_score: raw.user_hub_score, rewardId: raw.bounty_id, + bountyCreatorId: raw.bounty_creator_id ?? raw.bountyCreatorId, rewardType: raw.bounty_type, rewardExpirationDate: raw.bounty_expiration_date, };