]> git.proxmox.com Git - pmg-api.git/commitdiff
fix #2228: automatically deliver/delete on whitelist/blacklist
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Mar 2021 15:05:47 +0000 (17:05 +0200)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 31 Mar 2021 11:40:56 +0000 (13:40 +0200)
If a user chooses to blacklist a specific sender of a mail, the mail
is highly probably undesired too, so delete it in that case.

The reverse should hold for white listing a mail's sender, deliver it
in that case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/API2/Quarantine.pm

index 848ae8e6962f81e4ca60815e2279c0fe7ec55923..2fa1bb4d9b8e0afa34360966e5726072de56cf32 100644 (file)
@@ -1228,8 +1228,10 @@ __PACKAGE__->register_method ({
 
            if ($action eq 'whitelist') {
                PMG::Quarantine::add_to_blackwhite($dbh, $ref->{pmail}, 'WL', [ $sender ]);
+               PMG::Quarantine::deliver_quarantined_mail($dbh, $ref, $ref->{receiver} // $ref->{pmail});
            } elsif ($action eq 'blacklist') {
                PMG::Quarantine::add_to_blackwhite($dbh, $ref->{pmail}, 'BL', [ $sender ]);
+               PMG::Quarantine::delete_quarantined_mail($dbh, $ref);
            } elsif ($action eq 'deliver') {
                PMG::Quarantine::deliver_quarantined_mail($dbh, $ref, $ref->{receiver} // $ref->{pmail});
            } elsif ($action eq 'delete') {