public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui 1/4] fix #4137: display receiver in attachment/virus quarantine
Date: Thu, 20 Oct 2022 21:14:57 +0200	[thread overview]
Message-ID: <20221020191500.2414-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20221020191500.2414-1-s.ivanov@proxmox.com>

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 <s.ivanov@proxmox.com>
---
* 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 `<i class='fa ${iconCls}'></i> ${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 '<small>' + from + '</small><br>' + subject;
+	let ret = '<small>' + from;
+	if (render_receiver) {
+	    ret += '<br>To: ' + Ext.htmlEncode(rec.data.receiver);
+	}
+	ret += '</small><br>' + 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





  reply	other threads:[~2022-10-20 19:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20 19:14 [pmg-devel] [PATCH pmg-gui 0/4] low-hanging improvments for the quarantine interface Stoiko Ivanov
2022-10-20 19:14 ` Stoiko Ivanov [this message]
2022-10-22 14:30   ` [pmg-devel] applied: [PATCH pmg-gui 1/4] fix #4137: display receiver in attachment/virus quarantine Thomas Lamprecht
2022-10-20 19:14 ` [pmg-devel] [PATCH pmg-gui 2/4] quarantine: contextmenu: refactor for use in other quarantines Stoiko Ivanov
2022-10-22 14:32   ` [pmg-devel] applied: " Thomas Lamprecht
2022-10-20 19:14 ` [pmg-devel] [PATCH pmg-gui 3/4] quarantine: add common controller for all quarantines Stoiko Ivanov
2022-10-22 13:37   ` Thomas Lamprecht
2022-10-20 19:15 ` [pmg-devel] [PATCH pmg-gui 4/4] quarantine: move all quarantines to the new controller Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221020191500.2414-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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