From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
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 D86438D00C
 for <pmg-devel@lists.proxmox.com>; Mon,  7 Nov 2022 09:47:53 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id B543527B78
 for <pmg-devel@lists.proxmox.com>; Mon,  7 Nov 2022 09:47:23 +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 <pmg-devel@lists.proxmox.com>; Mon,  7 Nov 2022 09:47:23 +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 EB5B741957
 for <pmg-devel@lists.proxmox.com>; Mon,  7 Nov 2022 09:47:22 +0100 (CET)
Message-ID: <f583a683-dc13-ecd2-ec7e-9d8578628d95@proxmox.com>
Date: Mon, 7 Nov 2022 09:47:22 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:107.0) Gecko/20100101
 Thunderbird/107.0
Content-Language: en-GB
To: Dominik Csapak <d.csapak@proxmox.com>, pmg-devel@lists.proxmox.com
References: <20221104150425.124194-1-d.csapak@proxmox.com>
 <20221104150425.124194-3-d.csapak@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20221104150425.124194-3-d.csapak@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.034 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] applied: [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
 <pmg-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pmg-devel/>
List-Post: <mailto:pmg-devel@lists.proxmox.com>
List-Help: <mailto:pmg-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel>, 
 <mailto:pmg-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 07 Nov 2022 08:47:53 -0000

s/simply/simplify/, but I actually adapted it to
"quarantine controller: drop specialized classes, check at runtime instead"

(but the original was quite OK too, just had to fix this and another
typo anyway)

Am 04/11/2022 um 16:04 schrieb Dominik Csapak:
> 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.

I was a bit suspicious at first, as dropping some code by adding a runtime
(overhead check isn't always a benefit, but checking it out in context it
seems OK enough (quite a bit of code dropped and only a small overhead).

Alternative could be to add a single (or array of) property of reference IDs
we set the ID on, as config for the controller class, that could then be set
on instatation, but I don't think this will change much (as in new Q types
getting added or the like) and it's also really a much to small thing to
bother, so just mentioning for completeness sake.

> 
> also remove the stray 'xtype' of the QuarantineController
> (it's not a component, thus no xtype)

no biggie but you might just push that as separate patch directly next
time.

> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  js/AttachmentQuarantine.js            | 30 +--------------------------
>  js/SpamQuarantine.js                  | 13 ------------
>  js/controller/QuarantineController.js |  3 ++-
>  3 files changed, 3 insertions(+), 43 deletions(-)
> 
>

applied, thanks!