diff --git a/NEWS b/NEWS index e65b594e1..3d1aeb98a 100644 --- a/NEWS +++ b/NEWS @@ -20,13 +20,15 @@ Bug fixes - [web] properly null-terminate IS8601-formatted dates (#3539) - [web] display CC/BCC fields in message editor when initialized with values - [web] fixed message initialization in popup window (#3583) + - [web] create chip (recipient) on blur (#3470) - [web] fixed position of warning when JavaScript is disabled (#3449) - - [eas] properly unfold long mail headers (#3152) - [web] respect the LDAP attributes mapping in the list view - [web] handle empty body data when forwarding mails (#3581) - - [eas] correctly set EAS message class for S/MIME messages (#3576) - [web] show repeating events when we ask for "All" or "Future" events (#69) - [web] show the To instead of From when we are in the Sent folder (#3547) + - [web] fixed handling of mail tags in mail viewer + - [eas] properly unfold long mail headers (#3152) + - [eas] correctly set EAS message class for S/MIME messages (#3576) - [dav] we now handle the default classifications for tasks (#3541) - [eas] handle FilterType changes using EAS (#3543) diff --git a/UI/Templates/MailerUI/UIxMailViewTemplate.wox b/UI/Templates/MailerUI/UIxMailViewTemplate.wox index 3b421f7a9..36dd2d60a 100644 --- a/UI/Templates/MailerUI/UIxMailViewTemplate.wox +++ b/UI/Templates/MailerUI/UIxMailViewTemplate.wox @@ -168,22 +168,17 @@
+ ng-model="viewer.message.flags"> - + - {{viewer.service.$tags[$chip][0]}} + {{viewer.service.$tags[$chip][0] || $chip}}
diff --git a/UI/WebServerResources/js/Mailer/Message.service.js b/UI/WebServerResources/js/Mailer/Message.service.js index 889df3ef7..0a7cb2f9c 100644 --- a/UI/WebServerResources/js/Mailer/Message.service.js +++ b/UI/WebServerResources/js/Mailer/Message.service.js @@ -81,16 +81,18 @@ * @param {string} search - the search string to match * @returns a collection of strings */ - Message.filterTags = function(query) { + Message.filterTags = function(query, excludedTags) { var re = new RegExp(query, 'i'), results = []; _.forEach(_.keys(Message.$tags), function(tag) { var pair = Message.$tags[tag]; if (pair[0].search(re) != -1) { - results.push({ name: tag, description: pair[0], color: pair[1] }); + if (!_.includes(excludedTags, tag)) + results.push({ name: tag, description: pair[0], color: pair[1] }); } }); + return results; }; diff --git a/UI/WebServerResources/js/Mailer/MessageController.js b/UI/WebServerResources/js/Mailer/MessageController.js index 03f619a3a..6936d11ec 100644 --- a/UI/WebServerResources/js/Mailer/MessageController.js +++ b/UI/WebServerResources/js/Mailer/MessageController.js @@ -64,6 +64,31 @@ } }); } + else { + // Flatten new tags when coming from the predefined list of tags (Message.$tags) and + // sync tags with server when adding or removing a tag. + $scope.$watchCollection('viewer.message.flags', function(newTags, oldTags) { + var tags; + if (newTags || oldTags) { + _.forEach(newTags, function(tag, i) { + if (angular.isObject(tag)) + newTags[i] = tag.name; + }); + if (newTags.length > oldTags.length) { + tags = _.difference(newTags, oldTags); + _.forEach(tags, function(tag) { + vm.message.addTag(tag); + }); + } + else if (newTags.length < oldTags.length) { + tags = _.difference(oldTags, newTags); + _.forEach(tags, function(tag) { + vm.message.removeTag(tag); + }); + } + } + }); + } /** * If this is a popup window, retrieve the matching controllers (mailbox and message) of the parent window.