X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fnotifier.ts;h=740c274d72116cd1b4edf0c310bffffbb03c8be6;hb=75dd1b641f987e1e09dbaa3329e08c6e98a858f3;hp=6af7316f01cbc82aad8eaf9db10d61f3bf43cc14;hpb=b1771455af7ac0e3cfd1018865cc2bb44e048730;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/notifier.ts b/server/lib/notifier.ts index 6af7316f0..740c274d7 100644 --- a/server/lib/notifier.ts +++ b/server/lib/notifier.ts @@ -463,11 +463,11 @@ class Notifier { async function buildReporterOptions () { // Only notify our users - if (abuse.ReporterAccount.isOwned() !== true) return + if (abuse.ReporterAccount.isOwned() !== true) return undefined const reporter = await UserModel.loadByAccountActorId(abuse.ReporterAccount.actorId) // Don't notify my own message - if (reporter.Account.id === message.accountId) return + if (reporter.Account.id === message.accountId) return undefined return { users: [ reporter ], settingGetter, notificationCreator, emailSender: emailSenderReporter } } @@ -477,7 +477,7 @@ class Notifier { // Don't notify my own message moderators = moderators.filter(m => m.Account.id !== message.accountId) - if (moderators.length === 0) return + if (moderators.length === 0) return undefined return { users: moderators, settingGetter, notificationCreator, emailSender: emailSenderModerators } } @@ -489,8 +489,8 @@ class Notifier { return Promise.all( options - .filter(opt => opt) - .map(this.notify) + .filter(opt => !!opt) + .map(opt => this.notify(opt)) ) }