Fix regression where removing tags from one message would remove tag badge from all (Bifrost#T201124)
This commit is contained in:
parent
12ce9fd4c7
commit
09e8dcce98
1 changed files with 26 additions and 16 deletions
|
@ -520,7 +520,7 @@ function update_tags(response)
|
||||||
// @TODO: sort tags by name/prio
|
// @TODO: sort tags by name/prio
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal method to remove tags from messages and optionally tags cloud
|
// internal method to remove tags from messages and tags cloud
|
||||||
function remove_tags(tags, selection)
|
function remove_tags(tags, selection)
|
||||||
{
|
{
|
||||||
if (!tags || !tags.length) {
|
if (!tags || !tags.length) {
|
||||||
|
@ -537,13 +537,14 @@ function remove_tags(tags, selection)
|
||||||
// remove deleted tags
|
// remove deleted tags
|
||||||
$.each(tags, function() {
|
$.each(tags, function() {
|
||||||
var i, id = this,
|
var i, id = this,
|
||||||
filter = function() { return $(this).data('tag') == id; },
|
filter = function() { return $(this).data('tag') == id; };
|
||||||
elements = tagboxes.filter(filter);
|
|
||||||
|
|
||||||
// ... from the messages list (or message page)
|
|
||||||
elements.remove();
|
|
||||||
|
|
||||||
|
// When removing tags from selected messages only, we're using
|
||||||
|
// tag_remove_callback(), so here we can ignore that part
|
||||||
if (!selection) {
|
if (!selection) {
|
||||||
|
// ... from the messages list (or message page)
|
||||||
|
tagboxes.filter(filter).remove();
|
||||||
|
|
||||||
// ...from the tag cloud
|
// ...from the tag cloud
|
||||||
taglist.filter(filter).remove();
|
taglist.filter(filter).remove();
|
||||||
|
|
||||||
|
@ -554,12 +555,12 @@ function remove_tags(tags, selection)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ... from the message frame
|
// ... from the message frame
|
||||||
if (frame_tagboxes.length) {
|
if (frame_tagboxes.length) {
|
||||||
frame_tagboxes.filter(function() { return win.jQuery(this).data('tag') == id; }).remove();
|
frame_tagboxes.filter(function() { return win.jQuery(this).data('tag') == id; }).remove();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if tagged messages found and tag was selected - refresh the list
|
// if tagged messages found and tag was selected - refresh the list
|
||||||
if (!update_filter && $.inArray(String(id), tagsfilter) > -1) {
|
if (!update_filter && $.inArray(String(id), tagsfilter) > -1) {
|
||||||
|
@ -692,7 +693,7 @@ function tag_remove(props, obj, event)
|
||||||
|
|
||||||
// remove tags from message(s) without waiting to a response
|
// remove tags from message(s) without waiting to a response
|
||||||
// in case of an error the list will be refreshed
|
// in case of an error the list will be refreshed
|
||||||
tag_remove_callback(this.tag_find(props));
|
$.each(tags, function() { tag_remove_callback(this); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// update messages list and message frame after removing tag assignments
|
// update messages list and message frame after removing tag assignments
|
||||||
|
@ -701,16 +702,19 @@ function tag_remove_callback(tag)
|
||||||
if (!tag)
|
if (!tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var frame_window = rcmail.get_frame_window(rcmail.env.contentframe),
|
var uids = [],
|
||||||
list = rcmail.message_list;
|
win = rcmail.get_frame_window(rcmail.env.contentframe),
|
||||||
|
frame_tagboxes = win && win.jQuery ? win.jQuery('span.tagbox') : [],
|
||||||
|
list = main_list_widget();
|
||||||
|
|
||||||
if (list) {
|
if (list) {
|
||||||
$.each(list.get_selection(), function (i, uid) {
|
$.each(list.get_selection(), function (i, uid) {
|
||||||
var row = list.rows[uid];
|
var row = list.rows[uid];
|
||||||
if (row) {
|
if (row) {
|
||||||
$('span.tagbox', row.obj).each(function() {
|
$('span.tagbox', row.obj).each(function() {
|
||||||
if (!tag || $(this).data('tag') == tag.uid) {
|
if ($(this).data('tag') == tag) {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
|
uids.push(String(uid));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -718,10 +722,16 @@ function tag_remove_callback(tag)
|
||||||
|
|
||||||
message_list_select(list);
|
message_list_select(list);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
// TODO: remove tag(s) from the preview frame
|
$('span.tagbox').filter(function() { return $(this).data('tag') == tag; }).remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ... from the message frame (make sure it the selected message frame,
|
||||||
|
// i.e. when using contextmenu it might be not the selected one)
|
||||||
|
if (frame_tagboxes.length && $.inArray(String(win.rcmail.env.uid), uids) >= 0) {
|
||||||
|
frame_tagboxes.filter(function() { return win.jQuery(this).data('tag') == tag; }).remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// executes messages search according to selected messages
|
// executes messages search according to selected messages
|
||||||
function apply_tags_filter()
|
function apply_tags_filter()
|
||||||
|
|
Loading…
Add table
Reference in a new issue