Fix message labels handling

Selecting "none" from the label submenu on a multiple selection of
messages is now working. When changing the label of multiple messages,
the display is now properly updated.

Fixes #2902
pull/53/head
Francis Lachapelle 2014-08-29 15:33:56 -04:00
parent eaf815eae6
commit 1af52e6d6b
2 changed files with 10 additions and 12 deletions

5
NEWS
View File

@ -6,8 +6,8 @@ New features
Enchancements
- major refactoring of the GCS component saving code (dropped OGoContentStore)
- users can now print their calendars in colors with every views; list, daily, weekly and multicolumns
- users can choose to print their calendars events and tasks with the background color or with a border color
- printing calendars in colors is now possible in all views; list, daily, weekly and multicolumns
- new option to print calendars events and tasks with a background color or with a border color
Bug fixes
- fixed crasher when subscribing users to resources (#2892)
@ -18,6 +18,7 @@ Bug fixes
- fixed Can not delete mail when over quota (#2812)
- fixed Events and tasks cannot be moved to other calendars using drag&drop (#2759)
- fixed In "Multicolumn Day View" mouse position is not honored when creating an event (#2864)
- fixed handling of messages labels (#2902)
2.2.7 (2014-07-30)
------------------

View File

@ -2440,15 +2440,15 @@ function onMenuToggleMessageRead(event) {
}
function onMenuLabelNone() {
var messages = new Array();
var messages = [];
if (document.menuTarget.tagName == "DIV")
// Menu called from message content view
messages.push(Mailer.currentMessages[Mailer.currentMailbox]);
else if (Object.isArray(document.menuTarget))
// Menu called from multiple selection in messages list view
$(document.menuTarget).collect(function(row) {
messages.push(row.getAttribute("id").substr(4));
$(document.menuTarget).collect(function(rowID) {
messages.push(rowID.substr(4));
});
else
// Menu called from one selection in messages list view
@ -2561,21 +2561,18 @@ function messageFlagCallback(http) {
var operation = data["label"];
if (operation) {
var labels = row.getAttribute("labels");
var flags;
var flags = [];
if (labels.length > 0)
flags = labels.split(" ");
else
flags = new Array();
if (operation.substr(0, 3) == "add")
flags.push("label" + operation.substr(3));
flags.push(operation.substr(3));
else {
var flag = "label" + operation.substr(6);
// Remove flag
var flag = operation.substr(6);
var idx = flags.indexOf(flag);
flags.splice(idx, 1);
}
row.writeAttribute("labels", flags.join(" "));
row.toggleClassName("_selected");
row.toggleClassName("_selected");
}
else
row.writeAttribute("labels", "");