Refactor StatusPageSubscriberService to fix issue with sending notifications for unsubscribed subscribers

This commit is contained in:
Simon Larsen 2024-10-28 13:44:49 +00:00
parent 1affe3cdda
commit d619d2afff
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA

View File

@ -319,6 +319,7 @@ export class Service extends DatabaseService<Model> {
statusPage: StatusPage;
eventType: StatusPageEventType;
}): boolean {
let shouldSendNotification: boolean = true; // default to true.
if (data.subscriber.isUnsubscribed) {
@ -341,7 +342,7 @@ export class Service extends DatabaseService<Model> {
let shouldSendNotificationForResource: boolean = false;
if (subscriberResourceIds.length === 0) {
shouldSendNotificationForResource = true;
shouldSendNotificationForResource = false;
} else {
for (const resource of data.statusPageResources) {
if (