Commit 3bb1c598 authored by aguestuser's avatar aguestuser

Merge branch 'hotfix-dont-notify-on-empty-recycle-request-evaluations' into 'main'

[hotifx] don't notify maintainers about eventless recycle jobs

See merge request team-friendo/signalboost!385
parents 93f92ad6 332cf306
...@@ -51,17 +51,20 @@ const processRecycleRequests = async () => { ...@@ -51,17 +51,20 @@ const processRecycleRequests = async () => {
const recycleResults = await Promise.all(toRecycle.map(recycle)) const recycleResults = await Promise.all(toRecycle.map(recycle))
await recycleRequestRepository.destroyMany([...redeemed, ...toRecycle]) await recycleRequestRepository.destroyMany([...redeemed, ...toRecycle])
const redeemedChannels = await channelRepository.findManyDeep(redeemed) const redeemedChannels = await channelRepository.findManyDeep(redeemed)
const numProcessed = redeemed.length + toRecycle.length
return Promise.all([ return Promise.all([
...redeemedChannels.map(channel => ...redeemedChannels.map(channel =>
notifier.notifyAdmins(channel, notificationKeys.CHANNEL_REDEEMED), notifier.notifyAdmins(channel, notificationKeys.CHANNEL_REDEEMED),
), ),
notifier.notifyMaintainers( numProcessed === 0
`${redeemed.length + toRecycle.length} recycle requests processed:\n\n` + ? Promise.resolve()
`${redeemed.map(r => `${r} redeemed by admins.`).join('\n')}` + : notifier.notifyMaintainers(
'\n' + `${redeemed.length + toRecycle.length} recycle requests processed:\n\n` +
`${map(recycleResults, 'message').join('\n')}`, `${redeemed.map(r => `${r} redeemed by admins.`).join('\n')}` +
), '\n' +
`${map(recycleResults, 'message').join('\n')}`,
),
]) ])
} catch (err) { } catch (err) {
return notifier.notifyMaintainers(`Error processing recycle job: ${err}`) return notifier.notifyMaintainers(`Error processing recycle job: ${err}`)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment