diff --git a/plugins/kolab_tags/kolab_tags.js b/plugins/kolab_tags/kolab_tags.js index 329c18e0..2e68e922 100644 --- a/plugins/kolab_tags/kolab_tags.js +++ b/plugins/kolab_tags/kolab_tags.js @@ -350,7 +350,7 @@ function update_tags(response) tag_selector_reset(); // remove deleted tags - remove_tags(response['delete']); + remove_tags(response['delete'], response.mark); // add new tags $.each(response.add || [], function() { @@ -423,8 +423,7 @@ function remove_tags(tags, selection) $.each(tags, function() { var i, id = this, filter = function() { return $(this).data('tag') == id; }, - elements = tagboxes.filter(filter), - selected = $.inArray(String(id), tagsfilter); + elements = tagboxes.filter(filter); // ... from the messages list (or message page) elements.remove(); @@ -448,8 +447,7 @@ function remove_tags(tags, selection) } // if tagged messages found and tag was selected - refresh the list - if (selected > -1) { - tagsfilter.splice(selected, 1); + if (!update_filter && $.inArray(String(id), tagsfilter) > -1) { update_filter = true; } }); @@ -549,17 +547,13 @@ function tag_remove(props, obj, event) } var postdata = rcmail.selection_post_data(), - tags = props != '*' ? [props] : $.map(rcmail.env.tags, function(tag) { return tag.uid; }) - win = window.parent && parent.rcmail && parent.remove_tags ? parent : window; + tags = props != '*' ? [props] : $.map(rcmail.env.tags, function(tag) { return tag.uid; }), + rc = window.parent && parent.rcmail && parent.remove_tags ? parent.rcmail : rcmail; postdata._tag = props; postdata._act = 'remove'; - rcmail.http_post('plugin.kolab_tags', postdata, true); - - // remove tags from message(s) without waiting to a response - // in case of an error the list will be refreshed - win.remove_tags(tags, true); + rc.http_post('plugin.kolab_tags', postdata, true); } // executes messages search according to selected messages diff --git a/plugins/kolab_tags/lib/kolab_tags_engine.php b/plugins/kolab_tags/lib/kolab_tags_engine.php index 14a6e073..201b23ac 100644 --- a/plugins/kolab_tags/lib/kolab_tags_engine.php +++ b/plugins/kolab_tags/lib/kolab_tags_engine.php @@ -132,6 +132,7 @@ class kolab_tags_engine $filter = $tag == '*' ? array() : array(array('uid', '=', explode(',', $tag))); $taglist = $this->backend->list_tags($filter); $filter = array(); + $tags = array(); foreach (rcmail::get_uids() as $mbox => $uids) { if ($uids === '*') { @@ -181,6 +182,8 @@ class kolab_tags_engine $error = true; } } + + $tags[] = $tag['uid']; } if ($error) { @@ -191,6 +194,7 @@ class kolab_tags_engine } else { $this->rc->output->show_message($this->plugin->gettext('untaggingsuccess'), 'confirmation'); + $this->rc->output->command('plugin.kolab_tags', array('mark' => 1, 'delete' => $tags)); } }