(js) Fix handling of mail tags in msg viewer

This commit is contained in:
Francis Lachapelle
2016-03-28 10:43:16 -04:00
parent 506b8ceac7
commit 4eda59b3e7
4 changed files with 38 additions and 14 deletions
@@ -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;
};