From b1dacb07103063ff3584feb95bc65c48fb3f743d Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 24 Nov 2022 17:32:03 +0100 Subject: [PATCH] prune jobs: switch default to on-error-only notifications we can still do that as notifications for prune jobs weren't released yet. We may want to evaluate if we adapt (some) other notification types too on next major release. Signed-off-by: Thomas Lamprecht --- src/server/email_notifications.rs | 10 +++------- www/window/NotifyOptions.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs index 560b48a8..b3298cf9 100644 --- a/src/server/email_notifications.rs +++ b/src/server/email_notifications.rs @@ -425,13 +425,9 @@ pub fn send_prune_status( (None, _) => return Ok(()), }; - match notify.prune { - None => { /* send notifications by default */ } - Some(notify) => { - if notify == Notify::Never || (result.is_ok() && notify == Notify::Error) { - return Ok(()); - } - } + let notify_prune = notify.prune.unwrap_or(Notify::Error); + if notify_prune == Notify::Never || (result.is_ok() && notify_prune == Notify::Error) { + return Ok(()); } let (fqdn, port) = get_server_url(); diff --git a/www/window/NotifyOptions.js b/www/window/NotifyOptions.js index 7c7e6489..11765b43 100644 --- a/www/window/NotifyOptions.js +++ b/www/window/NotifyOptions.js @@ -10,6 +10,18 @@ Ext.define('PBS.form.NotifyType', { ], }); +Ext.define('PBS.form.NotifyErrorDefaultType', { + extend: 'Proxmox.form.KVComboBox', + alias: 'widget.pbsNotifyErrorDefaultType', + + comboItems: [ + ['__default__', gettext('Default (Errors)')], + ['always', gettext('Always')], + ['error', gettext('Errors')], + ['never', gettext('Never')], + ], +}); + Ext.define('PBS.window.NotifyOptions', { extend: 'Proxmox.window.Edit', xtype: 'pbsNotifyOptionEdit', @@ -73,7 +85,7 @@ Ext.define('PBS.window.NotifyOptions', { deleteEmpty: false, }, { - xtype: 'pbsNotifyType', + xtype: 'pbsNotifyErrorDefaultType', name: 'prune', fieldLabel: gettext('Prune Jobs'), value: '__default__',