From 3d146d0a6613b4a018509fd09c15082484685fb0 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:52:11 -0800 Subject: [PATCH] Overriding defaultTitle with subject for SNS notifications (#708) (#723) * 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 (cherry picked from commit 88536b233c56d687ae61b7c31b69b883b7b1affe) Co-authored-by: uroskarama <117112198+uroskarama@users.noreply.github.com> --- .../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 }