fix(notifications): correctly send notifications for users that do not have any user settings yet

fixes #1324
This commit is contained in:
sct
2021-03-30 21:02:33 +09:00
parent a908c07670
commit d3a25b935a
3 changed files with 13 additions and 13 deletions

View File

@@ -1,8 +1,8 @@
import axios from 'axios';
import { hasNotificationType, Notification } from '..';
import { MediaType } from '../../../constants/media';
import logger from '../../../logger';
import { getSettings, NotificationAgentTelegram } from '../../settings';
import { MediaType } from '../../../constants/media';
import { BaseAgent, NotificationAgent, NotificationPayload } from './agent';
interface TelegramMessagePayload {
@@ -180,7 +180,7 @@ class TelegramAgent
// Send user notification
if (
payload.notifyUser &&
payload.notifyUser.settings?.enableNotifications &&
(payload.notifyUser.settings?.enableNotifications ?? true) &&
payload.notifyUser.settings?.telegramChatId &&
payload.notifyUser.settings?.telegramChatId !==
this.getSettings().options.chatId