[pmg-devel] [PATCH pmg-gui 1/4] fix #4137: display receiver in attachment/virus quarantine

Stoiko Ivanov s.ivanov at proxmox.com
Thu Oct 20 21:14:57 CEST 2022


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 at 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





More information about the pmg-devel mailing list