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 48C0F8CC5E for ; Fri, 4 Nov 2022 16:04:59 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 122BC5679 for ; Fri, 4 Nov 2022 16:04:29 +0100 (CET) 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 ; Fri, 4 Nov 2022 16:04:26 +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 65C5144D5D for ; Fri, 4 Nov 2022 16:04:26 +0100 (CET) From: Dominik Csapak To: pmg-devel@lists.proxmox.com Date: Fri, 4 Nov 2022 16:04:21 +0100 Message-Id: <20221104150425.124194-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221104150425.124194-1-d.csapak@proxmox.com> References: <20221104150425.124194-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.066 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [data.id, rec.data] Subject: [pmg-devel] [PATCH pmg-gui 1/5] simply quarantine controllers a bit 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: Fri, 04 Nov 2022 15:04:59 -0000 by making use of the optional chaining operator, we don't need to override the 'onSelectMail' if both the attachment quarantine and the spam quarantine. simply call lookup(id)?.setID everytime for both the attachments and the spaminfo this makes the seperate attachment quarantine controller unnecessary. also remove the stray 'xtype' of the QuarantineController (it's not a component, thus no xtype) Signed-off-by: Dominik Csapak --- js/AttachmentQuarantine.js | 30 +-------------------------- js/SpamQuarantine.js | 13 ------------ js/controller/QuarantineController.js | 3 ++- 3 files changed, 3 insertions(+), 43 deletions(-) diff --git a/js/AttachmentQuarantine.js b/js/AttachmentQuarantine.js index 8abfcad..5e0c2ea 100644 --- a/js/AttachmentQuarantine.js +++ b/js/AttachmentQuarantine.js @@ -18,34 +18,6 @@ Ext.define('pmg-attachment-list', { idProperty: 'id', }); -Ext.define('PMG.AttachmentQuarantineController', { - extend: 'PMG.controller.QuarantineController', - alias: 'controller.attachmentquarantine', - xtype: 'pmgAttachmentQuarantineController', - - onSelectMail: function() { - let me = this; - let list = this.lookupReference('list'); - let selection = list.selModel.getSelection(); - if (selection.length <= 1) { - let rec = selection[0] || {}; - me.lookup('attachmentlist').setID(rec); - } - - me.callParent(); - }, - - control: { - 'button[reference=raw]': { - click: 'toggleRaw', - }, - 'pmgQuarantineList': { - selectionChange: 'onSelectMail', - }, - }, - -}); - Ext.define('PMG.AttachmentQuarantine', { extend: 'Ext.container.Container', xtype: 'pmgAttachmentQuarantine', @@ -64,7 +36,7 @@ Ext.define('PMG.AttachmentQuarantine', { downloadMailURL: get => '/api2/json/quarantine/download?mailid=' + encodeURIComponent(get('mailid')), }, }, - controller: 'attachmentquarantine', + controller: 'quarantine', items: [ { title: gettext('Attachment Quarantine'), diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js index cf7f181..c86ce79 100644 --- a/js/SpamQuarantine.js +++ b/js/SpamQuarantine.js @@ -54,18 +54,6 @@ Ext.define('PMG.SpamQuarantineController', { me.callParent(selection); }, - onSelectMail: function() { - let me = this; - let list = me.lookupReference('list'); - let selection = list.selModel.getSelection(); - if (selection.length <= 1) { - let rec = selection[0] || {}; - me.lookupReference('spaminfo').setID(rec); - } - me.callParent(); - }, - - toggleSpamInfo: function(btn) { var grid = this.lookupReference('spaminfo'); grid.setVisible(!grid.isVisible()); @@ -121,7 +109,6 @@ Ext.define('PMG.SpamQuarantineController', { click: 'toggleSpamInfo', }, 'pmgQuarantineList': { - selectionChange: 'onSelectMail', itemkeypress: 'keyPress', rowcontextmenu: 'openContextMenu', }, diff --git a/js/controller/QuarantineController.js b/js/controller/QuarantineController.js index dfe2915..d47af6a 100644 --- a/js/controller/QuarantineController.js +++ b/js/controller/QuarantineController.js @@ -1,6 +1,5 @@ Ext.define('PMG.controller.QuarantineController', { extend: 'Ext.app.ViewController', - xtype: 'controller.Quarantine', alias: 'controller.quarantine', updatePreview: function(raw, rec) { @@ -120,6 +119,8 @@ Ext.define('PMG.controller.QuarantineController', { } let rec = selection[0] || {}; + me.lookup('spaminfo')?.setID(rec); + me.lookup('attachmentlist')?.setID(rec); me.getViewModel().set('mailid', rec.data ? rec.data.id : ''); me.updatePreview(me.raw || false, rec); -- 2.30.2