From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <root@dev.dominic.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 1C270710FB
 for <pve-devel@lists.proxmox.com>; Wed,  7 Apr 2021 10:30:48 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 191DADE57
 for <pve-devel@lists.proxmox.com>; Wed,  7 Apr 2021 10:30:48 +0200 (CEST)
Received: from dev.dominic.proxmox.com (unknown [94.136.29.99])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 7B142DE43
 for <pve-devel@lists.proxmox.com>; Wed,  7 Apr 2021 10:30:47 +0200 (CEST)
Received: by dev.dominic.proxmox.com (Postfix, from userid 0)
 id 55A97216B4; Wed,  7 Apr 2021 10:30:47 +0200 (CEST)
From: =?UTF-8?q?Dominic=20J=C3=A4ger?= <d.jaeger@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed,  7 Apr 2021 10:30:45 +0200
Message-Id: <20210407083045.62463-2-d.jaeger@proxmox.com>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20210407083045.62463-1-d.jaeger@proxmox.com>
References: <20210407083045.62463-1-d.jaeger@proxmox.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  2
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery
 methods
 NO_DNS_FOR_FROM         0.379 Envelope sender has no MX or A DNS records
 RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_NONE                0.001 SPF: sender does not publish an SPF Record
Subject: [pve-devel] [PATCH manager 2/2] Close #1295: Make apt notifications
 configurable
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 07 Apr 2021 08:30:48 -0000

This way all users, including subscription users, can decide if they want to
receive notifications mails from pveupdate or not. Disabling notifications is
desirable if available updates are monitored externally, for example.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
---
 bin/pveupdate                 | 4 +---
 www/manager6/dc/OptionView.js | 5 +++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/pveupdate b/bin/pveupdate
index 99b52fe9..37e6e518 100755
--- a/bin/pveupdate
+++ b/bin/pveupdate
@@ -50,9 +50,7 @@ if (my $err = $@) {
 }
 
 my $info = PVE::INotify::read_file('subscription');
-# We assume that users with subscriptions want informations
-# about new packages.
-my $notify = ($info && $info->{status} eq 'Active') ? 1 : 0;
+my $notify = $dccfg->{notify_updates} // 1;
 eval { PVE::API2::APT->update_database({ node => $nodename, notify => $notify, quiet => 1 }); };
 if (my $err = $@) {
     syslog ('err', "update apt database failed: $err");
diff --git a/www/manager6/dc/OptionView.js b/www/manager6/dc/OptionView.js
index 0e783cf4..b36acd07 100644
--- a/www/manager6/dc/OptionView.js
+++ b/www/manager6/dc/OptionView.js
@@ -92,6 +92,11 @@ Ext.define('PVE.dc.OptionView', {
 	    vtype: 'proxmoxMail',
 	    defaultValue: 'root@$hostname',
 	});
+	me.add_boolean_row(
+	    'notify_updates',
+	    gettext('Notify about updates'),
+	    { defaultValue: 1 },
+	);
 	me.add_text_row('mac_prefix', gettext('MAC address prefix'), {
 	    deleteEmpty: true,
 	    vtype: 'MacPrefix',
-- 
2.20.1