Skip to content
This repository has been archived by the owner on Nov 10, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' into release-1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoh committed Jul 29, 2017
2 parents 5440250 + 283db83 commit b53aa98
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions markasjunk2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

function rcmail_markasjunk2(prop) {
if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length))
if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection(false).length))
return;

if (!prop || prop == 'markasjunk2')
Expand All @@ -29,7 +29,7 @@ function rcmail_markasjunk2(prop) {
if (rcmail.env.uid) {
if (rcmail.message_list.rows[rcmail.env.uid].has_children && !rcmail.message_list.rows[rcmail.env.uid].expanded) {
if (!rcmail.message_list.in_selection(rcmail.env.uid)) {
prev_sel = rcmail.message_list.get_selection();
prev_sel = rcmail.message_list.get_selection(false);
rcmail.message_list.select_row(rcmail.env.uid);
}

Expand All @@ -41,7 +41,7 @@ function rcmail_markasjunk2(prop) {
}
}
else {
selection = rcmail.message_list.get_selection();
selection = rcmail.message_list.get_selection(false);
for (var i in selection) {
if (rcmail.message_list.rows[selection[i]].has_children && !rcmail.message_list.rows[selection[i]].expanded)
rcmail.message_list.select_children(selection[i]);
Expand Down Expand Up @@ -69,21 +69,19 @@ function rcmail_markasjunk2_notjunk(prop) {
rcube_webmail.prototype.rcmail_markasjunk2_move = function(mbox, uids) {
var prev_uid = rcmail.env.uid;
var prev_sel = null;
var a_uids = $.isArray(uids) ? uids : uids.split(",");;
var a_uids = $.isArray(uids) ? uids : uids.split(",");

if (rcmail.message_list && a_uids.length == 1 && !rcmail.message_list.rows[a_uids[0]]) {
rcmail.env.uid = a_uids[0];
}
else if (rcmail.message_list && a_uids.length == 1 && !rcmail.message_list.in_selection(a_uids[0]) && !rcmail.env.threading) {
rcmail.env.uid = a_uids[0];
rcmail.message_list.remove_row(rcmail.env.uid, false);
}
else if (rcmail.message_list && (!rcmail.message_list.in_selection(a_uids[0]) || a_uids.length != rcmail.message_list.selection.length)) {
prev_sel = rcmail.message_list.get_selection();
rcmail.message_list.clear_selection();
if (rcmail.message_list) {
if (a_uids.length == 1 && !rcmail.message_list.rows[a_uids[0]]) {
rcmail.env.uid = a_uids[0];
}
else if (!rcmail.message_list.in_selection(a_uids[0]) || a_uids.length != rcmail.message_list.get_selection(false).length) {
prev_sel = rcmail.message_list.get_selection(false);
rcmail.message_list.clear_selection();

for (var i in a_uids)
rcmail.message_list.select_row(a_uids[i], CONTROL_KEY);
for (var i in a_uids)
rcmail.message_list.highlight_row(a_uids[i], true);
}
}

if (mbox)
Expand All @@ -96,10 +94,8 @@ rcube_webmail.prototype.rcmail_markasjunk2_move = function(mbox, uids) {
if (prev_sel) {
rcmail.message_list.clear_selection();

for (var i in prev_sel) {
if (prev_sel[i] != uid)
rcmail.message_list.select_row(prev_sel[i], CONTROL_KEY);
}
for (var i in prev_sel)
rcmail.message_list.highlight_row(prev_sel[i], true);
}
}

Expand Down Expand Up @@ -140,8 +136,8 @@ $(document).ready(function() {

if (rcmail.message_list) {
rcmail.message_list.addEventListener('select', function(list) {
rcmail.enable_command('plugin.markasjunk2.junk', list.get_selection().length > 0);
rcmail.enable_command('plugin.markasjunk2.not_junk', list.get_selection().length > 0);
rcmail.enable_command('plugin.markasjunk2.junk', list.get_selection(false).length > 0);
rcmail.enable_command('plugin.markasjunk2.not_junk', list.get_selection(false).length > 0);
});
}

Expand Down

0 comments on commit b53aa98

Please sign in to comment.