From c6392f216864404bf7ed43c416d2bd876aa8b7c7 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 22 Jan 2020 20:31:47 +0100 Subject: [PATCH] Markasjunk: Fix bug where marking as spam/ham didn't work on moving messages with drag-and-drop (#7137) --- CHANGELOG | 1 + plugins/markasjunk/drivers/cmd_learn.php | 5 ++++- plugins/markasjunk/markasjunk.js | 13 +++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2159a7a55..3d814b960 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail - Enigma: Fix so using list checkbox selection does not load the key preview frame - Enigma: Fix generation of key pairs for identities with IDN domains (#7181) - Enigma: Display IDN domains of key users and identities in UTF8 +- Markasjunk: Fix bug where marking as spam/ham didn't work on moving messages with drag-and-drop (#7137) - Password: Make chpass-wrapper.py Python 3 compatible (#7135) - Elastic: Fix disappearing sidebar in mail compose after clicking Mail button - Elastic: Fix incorrect aria-disabled attribute on Mail taskmenu button in mail compose diff --git a/plugins/markasjunk/drivers/cmd_learn.php b/plugins/markasjunk/drivers/cmd_learn.php index 60430beeb..da9511da5 100644 --- a/plugins/markasjunk/drivers/cmd_learn.php +++ b/plugins/markasjunk/drivers/cmd_learn.php @@ -102,8 +102,11 @@ class markasjunk_cmd_learn $output = shell_exec($tmp_command); if ($debug) { + if ($output) { + $tmp_command .= "\n$output"; + } + rcube::write_log('markasjunk', $tmp_command); - rcube::write_log('markasjunk', $output); } if (strpos($command, '%f') !== false) { diff --git a/plugins/markasjunk/markasjunk.js b/plugins/markasjunk/markasjunk.js index 4f1143efe..91ac19f39 100644 --- a/plugins/markasjunk/markasjunk.js +++ b/plugins/markasjunk/markasjunk.js @@ -111,17 +111,22 @@ if (window.rcmail) { rcmail.addEventListener('listupdate', function() { rcmail.markasjunk_toggle_button(); }); - rcmail.addEventListener('beforemoveto', function(mbox) { - if (mbox && typeof mbox === 'object') + rcmail.addEventListener('beforemove', function(mbox) { + if (mbox && typeof mbox === 'object') { mbox = mbox.id; + } + + if (!mbox) { + return; + } var is_spam = null; // check if destination mbox equals junk box (and we're not already in the junk box) - if (rcmail.env.markasjunk_move_spam && mbox && mbox == rcmail.env.markasjunk_spam_mailbox && mbox != rcmail.env.mailbox) + if (rcmail.env.markasjunk_move_spam && mbox == rcmail.env.markasjunk_spam_mailbox && mbox != rcmail.env.mailbox) is_spam = true; // or if destination mbox equals ham box and we are in the junk box - else if (rcmail.env.markasjunk_move_ham && mbox && mbox == rcmail.env.markasjunk_ham_mailbox && rcmail.env.mailbox == rcmail.env.markasjunk_spam_mailbox) + else if (rcmail.env.markasjunk_move_ham && mbox == rcmail.env.markasjunk_ham_mailbox && rcmail.env.mailbox == rcmail.env.markasjunk_spam_mailbox) is_spam = false; if (is_spam !== null) {