Skip to content

Commit 1eb1239

Browse files
committed
fix withdrawal notification
1 parent ee75554 commit 1eb1239

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

api/payIn/transitions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export async function payInWithdrawalPaid ({ data, models, ...args }) {
182182
}, { models, ...args })
183183

184184
if (transitionedPayIn) {
185-
await notifyWithdrawal(transitionedPayIn)
185+
notifyWithdrawal(transitionedPayIn).catch(console.error)
186186
const { payOutBolt11 } = transitionedPayIn
187187
if (payOutBolt11?.protocolId) {
188188
const { protocolId, userId } = payOutBolt11

lib/webPush.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,14 @@ export async function notifyDeposit (userId, invoice) {
416416
}
417417
}
418418

419-
export async function notifyWithdrawal (wdrwl) {
419+
export async function notifyWithdrawal (payOutBolt11) {
420420
try {
421-
await sendUserNotification(wdrwl.userId, {
422-
title: `${numWithUnits(msatsToSats(wdrwl.msatsPaid), { abbreviate: false, unitSingular: 'sat was', unitPlural: 'sats were' })} withdrawn from your account`,
423-
setting: 'noteWithdrawals'
424-
})
421+
if (payOutBolt11.msats > 1000) {
422+
await sendUserNotification(payOutBolt11.userId, {
423+
title: `${numWithUnits(msatsToSats(payOutBolt11.msats), { abbreviate: false, unitSingular: 'sat was', unitPlural: 'sats were' })} withdrawn from your account`,
424+
setting: 'noteWithdrawals'
425+
})
426+
}
425427
} catch (err) {
426428
log('error sending withdrawal notification:', err)
427429
}

0 commit comments

Comments
 (0)