Add missing unitSingular, unitPlural

This commit is contained in:
ekzyis 2024-03-26 00:53:49 +01:00
parent d1f36b77d2
commit a1317b97e9
2 changed files with 4 additions and 4 deletions

View File

@ -308,7 +308,7 @@ export async function notifyEarner (userId, earnings) {
export async function notifyDeposit (userId, invoice) {
try {
await sendUserNotification(userId, {
title: `${numWithUnits(msatsToSats(invoice.received_mtokens), { abbreviate: false })} were deposited in your account`,
title: `${numWithUnits(msatsToSats(invoice.received_mtokens), { abbreviate: false, unitSingular: 'sat was', unitPlural: 'sats were' })} deposited in your account`,
body: invoice.comment || undefined,
tag: 'DEPOSIT',
data: { sats: msatsToSats(invoice.received_mtokens) }
@ -321,7 +321,7 @@ export async function notifyDeposit (userId, invoice) {
export async function notifyWithdrawal (userId, wdrwl) {
try {
await sendUserNotification(userId, {
title: `${numWithUnits(msatsToSats(wdrwl.payment.mtokens), { abbreviate: false })} were withdrawn from your account`,
title: `${numWithUnits(msatsToSats(wdrwl.payment.mtokens), { abbreviate: false, unitSingular: 'sat was', unitPlural: 'sats were' })} withdrawn from your account`,
tag: 'WITHDRAWAL',
data: { sats: msatsToSats(wdrwl.payment.mtokens) }
})

View File

@ -154,9 +154,9 @@ const mergeAndShowNotification = async (sw, payload, currentNotifications, tag,
}
} else if (SUM_SATS_TAGS.includes(compareTag)) {
if (compareTag === 'DEPOSIT') {
title = `${numWithUnits(sats, { abbreviate: false })} were deposited in your account`
title = `${numWithUnits(sats, { abbreviate: false, unitSingular: 'sat was', unitPlural: 'sats were' })} deposited in your account`
} else if (compareTag === 'WITHDRAWAL') {
title = `${numWithUnits(sats, { abbreviate: false })} were withdrawn from your account`
title = `${numWithUnits(sats, { abbreviate: false, unitSingular: 'sat was', unitPlural: 'sats were' })} withdrawn from your account`
}
}
log(`[sw:push] ${nid} - calculated title: ${title}`)