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 D077B6929A for ; Mon, 22 Mar 2021 10:01:28 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C7DA7211EB for ; Mon, 22 Mar 2021 10:00:58 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id C4B8F211D9 for ; Mon, 22 Mar 2021 10:00:57 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8D08D4038E for ; Mon, 22 Mar 2021 10:00:57 +0100 (CET) From: Thomas Lamprecht To: pmg-devel@lists.proxmox.com Date: Mon, 22 Mar 2021 10:00:46 +0100 Message-Id: <20210322090046.26278-3-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210322090046.26278-1-t.lamprecht@proxmox.com> References: <20210322090046.26278-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.046 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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] fix #3164: allow one to display all quarantined spam mails 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: Mon, 22 Mar 2021 09:01:28 -0000 If the API call returned more than one pmail entry, inject an "all" entry which, if selected, drops the user parameter and loads the quarantine mails of all users from the backend. The webinterface has only some issues regarding deselection (all in the grid header or if we need to deselect due to the search filtering out some elements) - for that the underlying issue was found and a widget toolkit patch was provided. The rest seems now pretty performant, albeit more than a few 100k mails may become a problem here. But, in such big setups the mail admin won't tinker to much whith the users mail anyway, if they are even alowed to do so depending on their jurisdictions privacy laws and companies privacy policy. So, basically this is more for evaluation or for smaller setups but got quite often requested, and as there's not more data exposed/returned then already available I see no real argument against it. Signed-off-by: Thomas Lamprecht --- js/QuarantineList.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/js/QuarantineList.js b/js/QuarantineList.js index c5cab6e..9280489 100644 --- a/js/QuarantineList.js +++ b/js/QuarantineList.js @@ -76,6 +76,10 @@ Ext.define('PMG.QuarantineList', { } me.setEmptyText(); } + // deselect all first, else ExtJS does some funky O(n^3) comparissions as it tries + // to keep the selection, but we do not care for that on a new load anyway + view.getSelectionModel().deselectAll(); + store.load(function() { if (me.savedPosition !== undefined) { if (store.getCount() - 1 < me.savedPosition) { @@ -112,7 +116,11 @@ Ext.define('PMG.QuarantineList', { setUser: function(user) { let view = this.getView(); let params = view.getStore().getProxy().getExtraParams(); - params.pmail = user; + if (user === null) { + delete params.pmail; + } else { + params.pmail = user; + } view.getStore().getProxy().setExtraParams(params); view.user = user; }, @@ -164,7 +172,11 @@ Ext.define('PMG.QuarantineList', { let me = this; me.savedPosition = undefined; me.allowPositionSave = false; - me.setUser(value); + if (value === 'all') { + me.setUser(null); + } else { + me.setUser(value); + } me.load(); }, @@ -214,7 +226,8 @@ Ext.define('PMG.QuarantineList', { return match; }); if (toDeselect.length > 0) { - sm.deselect(toDeselect); + sm.deselect(toDeselect, true); + sm.maybeFireSelectionChange(true); } return selectedRecordId !== null && clearSelectedMail; }, @@ -313,6 +326,13 @@ Ext.define('PMG.QuarantineList', { renderer: Ext.htmlEncode, }, ], + listeners: { + load: function(store, records, successfull) { + if (successfull && records.length > 1) { + store.insert(0, { mail: 'all' }); + } + }, + }, }, queryMode: 'local', editable: true, -- 2.20.1