From 88536b233c56d687ae61b7c31b69b883b7b1affe Mon Sep 17 00:00:00 2001 From: uroskarama <117112198+uroskarama@users.noreply.github.com> Date: Tue, 20 Dec 2022 20:41:51 +0100 Subject: [PATCH] Overriding defaultTitle with subject for SNS notifications (#708) * Overriding defaultTitle with subject for SNS notifications Signed-off-by: uros * Overriding defaultTitle with subject for SNS notifications - condition fix Signed-off-by: uros Signed-off-by: uros --- .../util/destinationmigration/NotificationApiUtils.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/NotificationApiUtils.kt b/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/NotificationApiUtils.kt index cd44a7887..7b4dc8abf 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/NotificationApiUtils.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/NotificationApiUtils.kt @@ -138,12 +138,12 @@ suspend fun NotificationConfigInfo.sendNotification(client: Client, title: Strin } /** - * For most channel types, a placeholder Alerting title will be used but the email channel will - * use the subject, so it appears as the actual subject of the email. + * For most channel types, a placeholder Alerting title will be used but the email channel/SNS notification will + * use the subject, so it appears as the actual subject of the email/SNS notification. */ fun NotificationConfigInfo.getTitle(subject: String?): String { val defaultTitle = "Alerting-Notification Action" - if (this.notificationConfig.configType == ConfigType.EMAIL) { + if (this.notificationConfig.configType == ConfigType.EMAIL || this.notificationConfig.configType == ConfigType.SNS) { return if (subject.isNullOrEmpty()) defaultTitle else subject }