public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit] notify: sendmail: smtp: fix mailto/mailto-user parameter deletion
@ 2023-11-29 12:18 Lukas Wagner
  2023-12-11 15:55 ` Maximiliano Sandoval
  0 siblings, 1 reply; 3+ messages in thread
From: Lukas Wagner @ 2023-11-29 12:18 UTC (permalink / raw)
  To: pve-devel

Both fields were moved to a separate panel at some point, but this
broke parameter deletion behavior (e.g. if a target is modified and
switches from using mailto to mailto-user, then mailto should be
deleted)

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 src/panel/SendmailEditPanel.js | 7 +++++++
 src/panel/SmtpEditPanel.js     | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/src/panel/SendmailEditPanel.js b/src/panel/SendmailEditPanel.js
index 5a154c1..f943fa4 100644
--- a/src/panel/SendmailEditPanel.js
+++ b/src/panel/SendmailEditPanel.js
@@ -97,7 +97,14 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
 
 	if (values.mailto) {
 	    values.mailto = values.mailto.split(/[\s,;]+/);
+	} else if (!me.isCreate) {
+	    Proxmox.Utils.assemble_field_data(values, { 'delete': 'mailto' });
 	}
+
+	if (!values['mailto-user'] && !me.isCreate) {
+	    Proxmox.Utils.assemble_field_data(values, { 'delete': 'mailto-user' });
+	}
+
 	return values;
     },
 });
diff --git a/src/panel/SmtpEditPanel.js b/src/panel/SmtpEditPanel.js
index 8b258e0..128f1e3 100644
--- a/src/panel/SmtpEditPanel.js
+++ b/src/panel/SmtpEditPanel.js
@@ -173,6 +173,12 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
 
 	if (values.mailto) {
 	    values.mailto = values.mailto.split(/[\s,;]+/);
+	} else if (!me.isCreate) {
+	    Proxmox.Utils.assemble_field_data(values, { 'delete': 'mailto' });
+	}
+
+	if (!values['mailto-user'] && !me.isCreate) {
+	    Proxmox.Utils.assemble_field_data(values, { 'delete': 'mailto-user' });
 	}
 
 	if (!values.authentication && !me.isCreate) {
-- 
2.39.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH widget-toolkit] notify: sendmail: smtp: fix mailto/mailto-user parameter deletion
  2023-11-29 12:18 [pve-devel] [PATCH widget-toolkit] notify: sendmail: smtp: fix mailto/mailto-user parameter deletion Lukas Wagner
@ 2023-12-11 15:55 ` Maximiliano Sandoval
  2023-12-12  8:26   ` Lukas Wagner
  0 siblings, 1 reply; 3+ messages in thread
From: Maximiliano Sandoval @ 2023-12-11 15:55 UTC (permalink / raw)
  To: Proxmox VE development discussion


Lukas Wagner <l.wagner@proxmox.com> writes:

> Both fields were moved to a separate panel at some point, but this
> broke parameter deletion behavior (e.g. if a target is modified and
> switches from using mailto to mailto-user, then mailto should be
> deleted)
>
> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>

The commit message was not immediately clear for me.

If one sets X, Y as the values of "Recipient(s)", and "Additional
Recipients(s)" in a Sendmail notification target, and then modifies it
so that either X=`` or Y=``, /etc/pve/notifications.cfg will incorrectly
contain the old values instead of removing the corresponding line:

    sendmail: test
            mailto Y
            mailto-user X

Tested setting both mailto and mailto-user to `` from non-nil values and
switching their values around. The patch fixes this as far as my testing
went.

Tested-by: Maximiliano Sandoval <m.sandoval@proxmox.com>

--
Maximiliano




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH widget-toolkit] notify: sendmail: smtp: fix mailto/mailto-user parameter deletion
  2023-12-11 15:55 ` Maximiliano Sandoval
@ 2023-12-12  8:26   ` Lukas Wagner
  0 siblings, 0 replies; 3+ messages in thread
From: Lukas Wagner @ 2023-12-12  8:26 UTC (permalink / raw)
  To: Proxmox VE development discussion, Maximiliano Sandoval



On 12/11/23 16:55, Maximiliano Sandoval wrote:
> 
> The commit message was not immediately clear for me.
> 

I'll send a v2 with a clearer commit message and include your T-b 
trailer. Thanks for testing!

-- 
- Lukas




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-12  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 12:18 [pve-devel] [PATCH widget-toolkit] notify: sendmail: smtp: fix mailto/mailto-user parameter deletion Lukas Wagner
2023-12-11 15:55 ` Maximiliano Sandoval
2023-12-12  8:26   ` Lukas Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal