From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 316DF8A8AC for ; Thu, 20 Oct 2022 21:15:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 198FF1AB39 for ; Thu, 20 Oct 2022 21:15:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 20 Oct 2022 21:15:19 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2836E44ADC for ; Thu, 20 Oct 2022 21:15:19 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Thu, 20 Oct 2022 21:14:57 +0200 Message-Id: <20221020191500.2414-2-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221020191500.2414-1-s.ivanov@proxmox.com> References: <20221020191500.2414-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.176 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-gui 1/4] fix #4137: display receiver in attachment/virus quarantine X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2022 19:15:21 -0000 the attachment and virus quarantines contain all quarantined mail for all recipients - so we should display which mail is being delivered/deleted - mostly if a mail is sent to multiple addresses served by the same PMG. Signed-off-by: Stoiko Ivanov --- * the naming of the sender_renderer (which actually just adds the sender to the subject it actually renders) was adapted for the function name Probably a different choice for both might be clearer (sender_subject_renderer, sender_receiver_subject_renderer)? js/AttachmentQuarantine.js | 4 ++-- js/Utils.js | 23 ++++++++++++++++++----- js/VirusQuarantine.js | 4 ++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/js/AttachmentQuarantine.js b/js/AttachmentQuarantine.js index 6449012..5e41ada 100644 --- a/js/AttachmentQuarantine.js +++ b/js/AttachmentQuarantine.js @@ -117,9 +117,9 @@ Ext.define('PMG.AttachmentQuarantine', { columns: [ { - header: gettext('Sender/Subject'), + header: `${gettext('Sender')}/${gettext('Receiver')}/${gettext('Subject')}`, dataIndex: 'subject', - renderer: PMG.Utils.sender_renderer, + renderer: PMG.Utils.sender_receiver_renderer, flex: 1, }, { diff --git a/js/Utils.js b/js/Utils.js index 3b54f65..695967d 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -813,15 +813,28 @@ Ext.define('PMG.Utils', { return ` ${text}`; }, - sender_renderer: function(value, metaData, rec) { - var subject = Ext.htmlEncode(value); - var from = Ext.htmlEncode(rec.data.from); - var sender = Ext.htmlEncode(rec.data.sender); + addresses_subject_renderer: function(value, metaData, rec, render_receiver) { + let subject = Ext.htmlEncode(value); + let from = Ext.htmlEncode(rec.data.from); + let sender = Ext.htmlEncode(rec.data.sender); if (sender) { from = Ext.String.format(gettext("{0} on behalf of {1}"), sender, from); } - return '' + from + '
' + subject; + let ret = '' + from; + if (render_receiver) { + ret += '
To: ' + Ext.htmlEncode(rec.data.receiver); + } + ret += '

' + subject; + return ret; + }, + + sender_renderer: function(value, metaData, rec) { + return PMG.Utils.addresses_subject_renderer(value, metaData, rec, false); + }, + + sender_receiver_renderer: function(value, metaData, rec) { + return PMG.Utils.addresses_subject_renderer(value, metaData, rec, true); }, constructor: function() { diff --git a/js/VirusQuarantine.js b/js/VirusQuarantine.js index 7f27188..9e9e3b8 100644 --- a/js/VirusQuarantine.js +++ b/js/VirusQuarantine.js @@ -120,9 +120,9 @@ Ext.define('PMG.VirusQuarantine', { columns: [ { - header: gettext('Sender/Subject'), + header: `${gettext('Sender')}/${gettext('Receiver')}/${gettext('Subject')}`, dataIndex: 'subject', - renderer: PMG.Utils.sender_renderer, + renderer: PMG.Utils.sender_receiver_renderer, flex: 1, }, { -- 2.30.2