From 54e2a84f4111ecf2312d8e4b0afa9e7137e5dfa2 Mon Sep 17 00:00:00 2001
From: nscuro <nscuro@protonmail.com>
Date: Mon, 20 Nov 2023 19:39:09 +0100
Subject: [PATCH] Add alert option to log successful publishing

Signed-off-by: nscuro <nscuro@protonmail.com>
---
 src/i18n/locales/en.json                          | 2 ++
 src/views/administration/notifications/Alerts.vue | 8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json
index 4f5ba62d2..0c208edde 100644
--- a/src/i18n/locales/en.json
+++ b/src/i18n/locales/en.json
@@ -670,6 +670,8 @@
     "limit_to_tags": "Limit to Tags",
     "alert_created": "Alert created",
     "alert_deleted": "Alert deleted",
+    "alert_log_successful_publish": "Log successful publish",
+    "alert_log_successful_publish_help": "Emit a log message upon successful publishing of the alert to the destination, instead of only emitting logs when issues are encountered. Aids in debugging missing alerts, or making alert publishing auditable.",
     "change_password_next_login": "User must change password at next login",
     "password_never_expires": "Password never expires",
     "suspended": "Suspended",
diff --git a/src/views/administration/notifications/Alerts.vue b/src/views/administration/notifications/Alerts.vue
index 9db7ffcd2..20e0e9e42 100644
--- a/src/views/administration/notifications/Alerts.vue
+++ b/src/views/administration/notifications/Alerts.vue
@@ -126,6 +126,9 @@
                     <b-form-group>
                       <c-switch id="notificationEnabled" color="primary" v-model="enabled" label v-bind="labelIcon"/>
                       {{ $t('admin.enabled') }}
+                      <br/>
+                      <c-switch id="notificationLogSuccessfulPublish" color="primary" v-model="logSuccessfulPublish" label v-bind="labelIcon" :title="$t('admin.alert_log_successful_publish_help')" />
+                      {{ $t('admin.alert_log_successful_publish') }}
                     </b-form-group>
                     <b-form-group id="fieldset-2" :label="this.$t('admin.publisher_class')" label-for="input-2">
                       <b-form-input id="input-2" v-model="publisherClass" disabled class="form-control disabled" readonly trim />
@@ -216,6 +219,7 @@
                   uuid: row.uuid,
                   name: row.name,
                   enabled: row.enabled,
+                  logSuccessfulPublish: row.logSuccessfulPublish,
                   notifyChildren: row.notifyChildren,
                   publisherClass: row.publisher.publisherClass,
                   notificationLevel: row.notificationLevel,
@@ -240,6 +244,9 @@
                 enabled() {
                   this.updateNotificationRule();
                 },
+                logSuccessfulPublish() {
+                  this.updateNotificationRule();
+                },
                 notifyChildren() {
                   this.updateNotificationRule();
                 },
@@ -282,6 +289,7 @@
                     uuid: this.uuid,
                     name: this.name,
                     enabled: this.enabled,
+                    logSuccessfulPublish: this.logSuccessfulPublish,
                     notifyChildren: this.notifyChildren,
                     notificationLevel: this.notificationLevel,
                     publisherConfig: JSON.stringify({ destination: this.destination, jiraTicketType: this.jiraTicketType }),