feat(notif): prevent manage-request users receiving auto-approve notif from their requests (#1707) (#1709)

Email and webpush agents will filter out these users. Discord agent won't @ them.
pull/1710/head
Dustin Hildebrandt 4 years ago committed by GitHub
parent 8a805716e3
commit 9ead8bb1f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -249,7 +249,10 @@ class DiscordAgent
NotificationAgentKey.DISCORD, NotificationAgentKey.DISCORD,
type type
) && ) &&
user.settings?.discordId user.settings?.discordId &&
// Check if it's the user's own auto-approved request
(type !== Notification.MEDIA_AUTO_APPROVED ||
user.id !== payload.request?.requestedBy.id)
) )
.map((user) => `<@${user.settings?.discordId}>`) .map((user) => `<@${user.settings?.discordId}>`)
.join(' '); .join(' ');

@ -208,7 +208,10 @@ class EmailAgent
NotificationAgentKey.EMAIL, NotificationAgentKey.EMAIL,
type type
) ?? ) ??
true)) true)) &&
// Check if it's the user's own auto-approved request
(type !== Notification.MEDIA_AUTO_APPROVED ||
user.id !== payload.request?.requestedBy.id)
) )
.map(async (user) => { .map(async (user) => {
logger.debug('Sending email notification', { logger.debug('Sending email notification', {

@ -185,7 +185,10 @@ class WebPushAgent
NotificationAgentKey.WEBPUSH, NotificationAgentKey.WEBPUSH,
type type
) ?? ) ??
true) true) &&
// Check if it's the user's own auto-approved request
(type !== Notification.MEDIA_AUTO_APPROVED ||
user.id !== payload.request?.requestedBy.id)
); );
const allSubs = await userPushSubRepository const allSubs = await userPushSubRepository

Loading…
Cancel
Save