diff --git a/Common/Server/Services/UserOnCallLogService.ts b/Common/Server/Services/UserOnCallLogService.ts index 48ebe89d11..09c8dafbd4 100644 --- a/Common/Server/Services/UserOnCallLogService.ts +++ b/Common/Server/Services/UserOnCallLogService.ts @@ -376,6 +376,13 @@ export class Service extends DatabaseService { return NotificationRuleType.ON_CALL_EXECUTED_ALERT_EPISODE; } + if ( + userNotificationEventType === + UserNotificationEventType.IncidentEpisodeCreated + ) { + return NotificationRuleType.ON_CALL_EXECUTED_INCIDENT_EPISODE; + } + // Invalid user notification event type. throw new BadDataException("Invalid user notification event type."); } diff --git a/Common/Tests/Server/Services/AlertGroupingEngineService.test.ts b/Common/Tests/Server/Services/AlertGroupingEngineService.test.ts index 46892a61f1..5f50d3f8cf 100644 --- a/Common/Tests/Server/Services/AlertGroupingEngineService.test.ts +++ b/Common/Tests/Server/Services/AlertGroupingEngineService.test.ts @@ -461,8 +461,9 @@ describe("Template Variable Replacement Logic", () => { describe("Default Title Generation", () => { test("should use monitor name when no template provided", () => { - const defaultTitle: string = `Alert Episode: ${mockAlert.monitor?.name || mockAlert.title || "Alert Episode"}`; - expect(defaultTitle).toBe("Alert Episode: API Server"); + const defaultTitle: string = + mockAlert.monitor?.name || mockAlert.title || "Untitled Episode"; + expect(defaultTitle).toBe("API Server"); }); test("should use alert title when no monitor", () => { @@ -473,8 +474,11 @@ describe("Template Variable Replacement Logic", () => { alertNoMonitor.title = "High CPU Usage"; // monitor is intentionally not set - const defaultTitle: string = `Alert Episode: ${alertNoMonitor.monitor?.name || alertNoMonitor.title || "Alert Episode"}`; - expect(defaultTitle).toBe("Alert Episode: High CPU Usage"); + const defaultTitle: string = + alertNoMonitor.monitor?.name || + alertNoMonitor.title || + "Untitled Episode"; + expect(defaultTitle).toBe("High CPU Usage"); }); test("should use generic title when no monitor and no alert title", () => { @@ -484,8 +488,9 @@ describe("Template Variable Replacement Logic", () => { alertMinimal.id = alertId; // monitor and title are intentionally not set - const defaultTitle: string = `Alert Episode: ${alertMinimal.monitor?.name || alertMinimal.title || "Alert Episode"}`; - expect(defaultTitle).toBe("Alert Episode: Alert Episode"); + const defaultTitle: string = + alertMinimal.monitor?.name || alertMinimal.title || "Untitled Episode"; + expect(defaultTitle).toBe("Untitled Episode"); }); }); }); diff --git a/Common/Types/NotificationRule/NotificationRuleType.ts b/Common/Types/NotificationRule/NotificationRuleType.ts index b0298becb5..78450838a8 100644 --- a/Common/Types/NotificationRule/NotificationRuleType.ts +++ b/Common/Types/NotificationRule/NotificationRuleType.ts @@ -2,6 +2,7 @@ enum NotificationRuleType { ON_CALL_EXECUTED_INCIDENT = "When incident on-call policy is executed", ON_CALL_EXECUTED_ALERT = "When alert on-call policy is executed", ON_CALL_EXECUTED_ALERT_EPISODE = "When alert episode on-call policy is executed", + ON_CALL_EXECUTED_INCIDENT_EPISODE = "When incident episode on-call policy is executed", WHEN_USER_GOES_ON_CALL = "When user goes on call", WHEN_USER_GOES_OFF_CALL = "When user goes off call", }