(js) Update lodash to version 4.6.1

pull/201/head
Francis Lachapelle 2016-03-03 13:38:54 -05:00
parent fadf52b01e
commit d4745ef598
22 changed files with 116 additions and 118 deletions

1
NEWS
View File

@ -22,6 +22,7 @@ Enhancements
- [web] improve display of messages with many recipients - [web] improve display of messages with many recipients
- [web] colorize categories chips in event and task viewers - [web] colorize categories chips in event and task viewers
- [web] initial stylesheet for printing - [web] initial stylesheet for printing
- [web] updated lodash to version 4.6.1
- [eas] now support EAS MIME truncation - [eas] now support EAS MIME truncation
Bug fixes Bug fixes

View File

@ -137,7 +137,7 @@ module.exports = function(grunt) {
'<%= src %>/angular-ui-router/release/angular-ui-router{,.min}.js', '<%= src %>/angular-ui-router/release/angular-ui-router{,.min}.js',
'<%= src %>/angular-file-upload/dist/angular-file-upload{,.min}.js{,.map}', '<%= src %>/angular-file-upload/dist/angular-file-upload{,.min}.js{,.map}',
//'<%= src %>/ng-file-upload/ng-file-upload{,.min}.js{,map}', //'<%= src %>/ng-file-upload/ng-file-upload{,.min}.js{,map}',
'<%= src %>/lodash/lodash{,.min}.js' '<%= src %>/lodash/dist/lodash{,.min}.js'
]; ];
for (var j = 0; j < js.length; j++) { for (var j = 0; j < js.length; j++) {
var files = grunt.file.expand(grunt.template.process(js[j], {data: options})); var files = grunt.file.expand(grunt.template.process(js[j], {data: options}));

View File

@ -81,7 +81,7 @@
var _this = this, var _this = this,
deferred = Acl.$q.defer(), deferred = Acl.$q.defer(),
param = {uid: user.uid}; param = {uid: user.uid};
if (!user.uid || _.indexOf(_.pluck(this.users, 'uid'), user.uid) > -1) { if (!user.uid || _.indexOf(_.map(this.users, 'uid'), user.uid) > -1) {
// No UID specified or user already in ACLs // No UID specified or user already in ACLs
deferred.resolve(); deferred.resolve();
} }
@ -116,7 +116,7 @@
var _this = this, var _this = this,
param = {uid: uid}; param = {uid: uid};
return Acl.$$resource.fetch(this.folderId, 'removeUserFromAcls', param).then(function() { return Acl.$$resource.fetch(this.folderId, 'removeUserFromAcls', param).then(function() {
var i = _.indexOf(_.pluck(_this.users, 'uid'), uid); var i = _.indexOf(_.map(_this.users, 'uid'), uid);
if (i >= 0) { if (i >= 0) {
_this.users.splice(i, 1); _this.users.splice(i, 1);
} }

View File

@ -77,7 +77,7 @@
if (excludedUsers) { if (excludedUsers) {
// Remove excluded users from response // Remove excluded users from response
results = _.filter(response.users, function(user) { results = _.filter(response.users, function(user) {
return !_.find(excludedUsers, compareUids, user); return !_.find(excludedUsers, _.bind(compareUids, user));
}); });
} }
else { else {
@ -87,13 +87,13 @@
// Remove users that no longer match the search query // Remove users that no longer match the search query
for (index = users.length - 1; index >= 0; index--) { for (index = users.length - 1; index >= 0; index--) {
user = users[index]; user = users[index];
if (!_.find(results, compareUids, user)) { if (!_.find(results, _.bind(compareUids, user))) {
users.splice(index, 1); users.splice(index, 1);
} }
} }
// Add new users matching the search query // Add new users matching the search query
_.each(results, function(data, index) { _.forEach(results, function(data, index) {
if (_.isUndefined(_.find(users, compareUids, data))) { if (_.isUndefined(_.find(users, _.bind(compareUids, data)))) {
var user = new User(data); var user = new User(data);
users.splice(index, 0, user); users.splice(index, 0, user);
} }

View File

@ -73,7 +73,7 @@
addRule(fgHue, bgHue, themeName, paletteName, _$mdThemingProvider._PALETTES[color.name][color.hues['hue-1'] ], 'hue-1'); addRule(fgHue, bgHue, themeName, paletteName, _$mdThemingProvider._PALETTES[color.name][color.hues['hue-1'] ], 'hue-1');
}); });
//$log.debug(_.pluck(customSheet.cssRules, 'cssText').join("\n")); //$log.debug(_.map(customSheet.cssRules, 'cssText').join("\n"));
}); });
function addRule(fgInterpolate, bgInterpolate, themeName, paletteName, colorArray, hueName){ function addRule(fgInterpolate, bgInterpolate, themeName, paletteName, colorArray, hueName){

View File

@ -41,11 +41,11 @@
modelDays = days; modelDays = days;
if (attrs.sgToggleGridAttr) { if (attrs.sgToggleGridAttr) {
modelAttr = attrs.sgToggleGridAttr; modelAttr = attrs.sgToggleGridAttr;
flattenedDays = _.pluck(days, attrs.sgToggleGridAttr); flattenedDays = _.map(days, attrs.sgToggleGridAttr);
} }
_.each(tiles, function(o) { _.forEach(tiles, function(o) {
var tile = angular.element(o); var tile = angular.element(o);
if (_.contains(flattenedDays, tile.attr('value'))) { if (_.includes(flattenedDays, tile.attr('value'))) {
tile.addClass('sg-active'); tile.addClass('sg-active');
} }
}); });

View File

@ -1,4 +1,4 @@
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
(function() { (function() {
'use strict'; 'use strict';
@ -106,7 +106,7 @@
if (excludedCards) { if (excludedCards) {
// Remove excluded cards from results // Remove excluded cards from results
results = _.filter(response.contacts, function(data) { results = _.filter(response.contacts, function(data) {
return _.isUndefined(_.find(excludedCards, compareIds, data)); return _.isUndefined(_.find(excludedCards, _.bind(compareIds, data)));
}); });
} }
else { else {
@ -115,13 +115,13 @@
// Remove cards that no longer match the search query // Remove cards that no longer match the search query
for (index = AddressBook.$cards.length - 1; index >= 0; index--) { for (index = AddressBook.$cards.length - 1; index >= 0; index--) {
card = AddressBook.$cards[index]; card = AddressBook.$cards[index];
if (_.isUndefined(_.find(results, compareIds, card))) { if (_.isUndefined(_.find(results, _.bind(compareIds, card)))) {
AddressBook.$cards.splice(index, 1); AddressBook.$cards.splice(index, 1);
} }
} }
// Add new cards matching the search query // Add new cards matching the search query
_.each(results, function(data, index) { _.forEach(results, function(data, index) {
if (_.isUndefined(_.find(AddressBook.$cards, compareIds, data))) { if (_.isUndefined(_.find(AddressBook.$cards, _.bind(compareIds, data)))) {
var card = new AddressBook.$Card(data, search); var card = new AddressBook.$Card(data, search);
AddressBook.$cards.splice(index, 0, card); AddressBook.$cards.splice(index, 0, card);
} }
@ -146,7 +146,7 @@
(o.id != 'personal' && (o.id != 'personal' &&
o.name.localeCompare(addressbook.name) === 1)); o.name.localeCompare(addressbook.name) === 1));
}); });
i = sibling ? _.indexOf(_.pluck(list, 'id'), sibling.id) : 1; i = sibling ? _.indexOf(_.map(list, 'id'), sibling.id) : 1;
list.splice(i, 0, addressbook); list.splice(i, 0, addressbook);
}; };
@ -459,14 +459,14 @@
}; };
// First entry of 'headers' are keys // First entry of 'headers' are keys
fields = _.invoke(response.headers[0], 'toLowerCase'); fields = _.invokeMap(response.headers[0], 'toLowerCase');
idFieldIndex = fields.indexOf('id'); idFieldIndex = fields.indexOf('id');
response.headers.splice(0, 1); response.headers.splice(0, 1);
if (excludedCards) if (excludedCards)
// Remove excluded cards from results // Remove excluded cards from results
results = _.filter(response.ids, function(id) { results = _.filter(response.ids, function(id) {
return _.isUndefined(_.find(excludedCards, compareIds, id)); return _.isUndefined(_.find(excludedCards, _.bind(compareIds, id)));
}); });
else else
results = response.ids; results = response.ids;
@ -474,14 +474,14 @@
// Remove cards that no longer match the search query // Remove cards that no longer match the search query
for (index = cards.length - 1; index >= 0; index--) { for (index = cards.length - 1; index >= 0; index--) {
card = cards[index]; card = cards[index];
if (_.isUndefined(_.find(results, compareIds, card.id))) { if (_.isUndefined(_.find(results, _.bind(compareIds, card.id)))) {
cards.splice(index, 1); cards.splice(index, 1);
} }
} }
// Add new cards matching the search query // Add new cards matching the search query
_.each(results, function(cardId, index) { _.forEach(results, function(cardId, index) {
if (_.isUndefined(_.find(cards, compareIds, cardId))) { if (_.isUndefined(_.find(cards, _.bind(compareIds, cardId)))) {
var data = { id: cardId }; var data = { id: cardId };
var card = new AddressBook.$Card(data, search); var card = new AddressBook.$Card(data, search);
cards.splice(index, 0, card); cards.splice(index, 0, card);
@ -489,20 +489,20 @@
}); });
// Respect the order of the results // Respect the order of the results
_.each(results, function(cardId, index) { _.forEach(results, function(cardId, index) {
var oldIndex, removedCards; var oldIndex, removedCards;
if (cards[index].id != cardId) { if (cards[index].id != cardId) {
oldIndex = _.findIndex(cards, compareIds, cardId); oldIndex = _.findIndex(cards, _.bind(compareIds, cardId));
removedCards = cards.splice(oldIndex, 1); removedCards = cards.splice(oldIndex, 1);
cards.splice(index, 0, removedCards[0]); cards.splice(index, 0, removedCards[0]);
} }
}); });
// Extend Card objects with received headers // Extend Card objects with received headers
_.each(response.headers, function(data) { _.forEach(response.headers, function(data) {
var card, index = _.findIndex(cards, compareIds, data[idFieldIndex]); var card, index = _.findIndex(cards, _.bind(compareIds, data[idFieldIndex]));
if (index > -1) { if (index > -1) {
card = _.object(fields, data); card = _.zipObject(fields, data);
cards[index].init(card, search); cards[index].init(card, search);
} }
}); });
@ -527,7 +527,7 @@
* @returns a promise of the HTTP operation * @returns a promise of the HTTP operation
*/ */
AddressBook.prototype.$rename = function(name) { AddressBook.prototype.$rename = function(name) {
var i = _.indexOf(_.pluck(AddressBook.$addressbooks, 'id'), this.id); var i = _.indexOf(_.map(AddressBook.$addressbooks, 'id'), this.id);
this.name = name; this.name = name;
AddressBook.$addressbooks.splice(i, 1); AddressBook.$addressbooks.splice(i, 1);
AddressBook.$add(this); AddressBook.$add(this);
@ -556,7 +556,7 @@
} }
promise.then(function() { promise.then(function() {
var i = _.indexOf(_.pluck(list, 'id'), _this.id); var i = _.indexOf(_.map(list, 'id'), _this.id);
list.splice(i, 1); list.splice(i, 1);
d.resolve(); d.resolve();
}, d.reject); }, d.reject);
@ -570,12 +570,14 @@
* @return a promise of the HTTP operation * @return a promise of the HTTP operation
*/ */
AddressBook.prototype.$deleteCards = function(cards) { AddressBook.prototype.$deleteCards = function(cards) {
var _this = this,
var uids = _.map(cards, function(card) { return card.id; }); ids = _.map(cards, function(card) { return card.id; });
var _this = this;
return AddressBook.$$resource.post(this.id, 'batchDelete', {uids: uids}).then(function() { return AddressBook.$$resource.post(this.id, 'batchDelete', {uids: ids}).then(function() {
_this.$cards = _.difference(_this.$cards, cards); _this.$cards = _.differenceBy(_this.$cards, cards, 'id');
_.forEach(cards, function(card) {
delete _this.idsMap[card.id];
});
}); });
}; };
@ -679,13 +681,13 @@
if (response.headers) { if (response.headers) {
// First entry of 'headers' are keys // First entry of 'headers' are keys
headers = _.invoke(response.headers[0], 'toLowerCase'); headers = _.invokeMap(response.headers[0], 'toLowerCase');
response.headers.splice(0, 1); response.headers.splice(0, 1);
if (_this.ids) { if (_this.ids) {
// Extend Card objects with received headers // Extend Card objects with received headers
_.each(response.headers, function(data) { _.forEach(response.headers, function(data) {
var o = _.object(headers, data), var o = _.zipObject(headers, data),
i = _this.idsMap[o.id]; i = _this.idsMap[o.id];
_this.$cards[i].init(o); _this.$cards[i].init(o);
}); });
@ -694,7 +696,7 @@
// Instanciate Card objects // Instanciate Card objects
_this.$cards = []; _this.$cards = [];
angular.forEach(response.headers, function(data) { angular.forEach(response.headers, function(data) {
var o = _.object(headers, data); var o = _.zipObject(headers, data);
_this.$cards.push(new AddressBook.$Card(o)); _this.$cards.push(new AddressBook.$Card(o));
}); });
} }
@ -735,10 +737,10 @@
var headers, j; var headers, j;
if (data.length > 0) { if (data.length > 0) {
// First entry of 'headers' are keys // First entry of 'headers' are keys
headers = _.invoke(data[0], 'toLowerCase'); headers = _.invokeMap(data[0], 'toLowerCase');
data.splice(0, 1); data.splice(0, 1);
_.each(data, function(cardHeaders) { _.forEach(data, function(cardHeaders) {
cardHeaders = _.object(headers, cardHeaders); cardHeaders = _.zipObject(headers, cardHeaders);
j = _this.idsMap[cardHeaders.id]; j = _this.idsMap[cardHeaders.id];
if (angular.isDefined(j)) { if (angular.isDefined(j)) {
_this.$cards[j].init(cardHeaders); _this.$cards[j].init(cardHeaders);

View File

@ -84,7 +84,7 @@
} }
function unselectCards() { function unselectCards() {
_.each(vm.selectedFolder.$cards, function(card) { card.selected = false; }); _.forEach(vm.selectedFolder.$cards, function(card) { card.selected = false; });
} }
function confirmDeleteSelectedCards() { function confirmDeleteSelectedCards() {
@ -96,14 +96,12 @@
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; }); var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
vm.selectedFolder.$deleteCards(selectedCards); vm.selectedFolder.$deleteCards(selectedCards);
delete vm.selectedFolder.selectedCard; delete vm.selectedFolder.selectedCard;
}, function(data, status) {
// Delete failed
}); });
} }
function saveSelectedCards() { function saveSelectedCards() {
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; }); var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
var selectedUIDs = _.pluck(selectedCards, 'id'); var selectedUIDs = _.map(selectedCards, 'id');
$window.location.href = ApplicationBaseURL + '/' + vm.selectedFolder.id + '/export?uid=' + selectedUIDs.join('&uid='); $window.location.href = ApplicationBaseURL + '/' + vm.selectedFolder.id + '/export?uid=' + selectedUIDs.join('&uid=');
} }
@ -111,13 +109,11 @@
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; }); var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
vm.selectedFolder.$copyCards(selectedCards, folder).then(function() { vm.selectedFolder.$copyCards(selectedCards, folder).then(function() {
// TODO: refresh target addressbook? // TODO: refresh target addressbook?
}, function(error) {
Dialog.alert(l('Error'), error);
}); });
} }
function selectAll() { function selectAll() {
_.each(vm.selectedFolder.$cards, function(card) { _.forEach(vm.selectedFolder.$cards, function(card) {
card.selected = true; card.selected = true;
}); });
} }
@ -176,14 +172,14 @@
var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; }); var selectedCards = _.filter(vm.selectedFolder.$cards, function(card) { return card.selected; });
var promises = [], recipients = []; var promises = [], recipients = [];
_.each(selectedCards, function(card) { _.forEach(selectedCards, function(card) {
if (card.c_component == 'vcard' && card.c_mail.length) { if (card.c_component == 'vcard' && card.c_mail.length) {
recipients.push({full: card.c_cn + ' <' + card.c_mail + '>'}); recipients.push({full: card.c_cn + ' <' + card.c_mail + '>'});
} }
else if (card.$isList()) { else if (card.$isList()) {
// If the list's members were already fetch, use them // If the list's members were already fetch, use them
if (angular.isDefined(card.refs) && card.refs.length) { if (angular.isDefined(card.refs) && card.refs.length) {
_.each(card.refs, function(ref) { _.forEach(card.refs, function(ref) {
if (ref.email.length) if (ref.email.length)
recipients.push({full: ref.c_cn + ' <' + ref.email + '>'}); recipients.push({full: ref.c_cn + ' <' + ref.email + '>'});
}); });
@ -191,7 +187,7 @@
else { else {
promises.push(vm.selectedFolder.$getCard(card.id).then(function(card) { promises.push(vm.selectedFolder.$getCard(card.id).then(function(card) {
return card.$futureCardData.then(function(data) { return card.$futureCardData.then(function(data) {
_.each(data.refs, function(ref) { _.forEach(data.refs, function(ref) {
if (ref.email.length) if (ref.email.length)
recipients.push({full: ref.c_cn + ' <' + ref.email + '>'}); recipients.push({full: ref.c_cn + ' <' + ref.email + '>'});
}); });

View File

@ -78,7 +78,7 @@
if (form.$valid) { if (form.$valid) {
vm.card.$save() vm.card.$save()
.then(function(data) { .then(function(data) {
var i = _.indexOf(_.pluck(AddressBook.selectedFolder.$cards, 'id'), vm.card.id); var i = _.indexOf(_.map(AddressBook.selectedFolder.$cards, 'id'), vm.card.id);
if (i < 0) { if (i < 0) {
// New card; reload contacts list and show addressbook in which the card has been created // New card; reload contacts list and show addressbook in which the card has been created
AddressBook.selectedFolder.$reload(); AddressBook.selectedFolder.$reload();

View File

@ -12,7 +12,7 @@
// Data is immediately available // Data is immediately available
if (typeof futureAccountData.then !== 'function') { if (typeof futureAccountData.then !== 'function') {
angular.extend(this, futureAccountData); angular.extend(this, futureAccountData);
_.each(this.identities, function(identity) { _.forEach(this.identities, function(identity) {
if (identity.fullName) if (identity.fullName)
identity.full = identity.fullName + ' <' + identity.email + '>'; identity.full = identity.fullName + ' <' + identity.email + '>';
else else
@ -147,7 +147,7 @@
allMailboxes = [], allMailboxes = [],
expandedMailboxes = [], expandedMailboxes = [],
_visit = function(mailboxes) { _visit = function(mailboxes) {
_.each(mailboxes, function(o) { _.forEach(mailboxes, function(o) {
allMailboxes.push(o); allMailboxes.push(o);
if ((options && options.all || o.$expanded) && o.children && o.children.length > 0) { if ((options && options.all || o.$expanded) && o.children && o.children.length > 0) {
_visit(o.children); _visit(o.children);
@ -291,7 +291,7 @@
var _this = this, var _this = this,
deferred = Account.$q.defer(), deferred = Account.$q.defer(),
param = {uid: user.uid}; param = {uid: user.uid};
if (!user.uid || _.indexOf(_.pluck(this.delegates, 'uid'), user.uid) > -1) { if (!user.uid || _.indexOf(_.map(this.delegates, 'uid'), user.uid) > -1) {
// No UID specified or user already in delegates // No UID specified or user already in delegates
deferred.resolve(); deferred.resolve();
} }
@ -317,7 +317,7 @@
var _this = this, var _this = this,
param = {uid: uid}; param = {uid: uid};
return Account.$$resource.fetch(this.id.toString(), 'removeDelegate', param).then(function() { return Account.$$resource.fetch(this.id.toString(), 'removeDelegate', param).then(function() {
var i = _.indexOf(_.pluck(_this.delegates, 'uid'), uid); var i = _.indexOf(_.map(_this.delegates, 'uid'), uid);
if (i >= 0) { if (i >= 0) {
_this.delegates.splice(i, 1); _this.delegates.splice(i, 1);
} }

View File

@ -277,7 +277,7 @@
return !filter.searchInput || filter.searchInput.length === 0; return !filter.searchInput || filter.searchInput.length === 0;
}); });
// Decompose filters that match two fields // Decompose filters that match two fields
_.each(options.filters, function(filter) { _.forEach(options.filters, function(filter) {
var secondFilter, var secondFilter,
match = filter.searchBy.match(/(\w+)_or_(\w+)/); match = filter.searchBy.match(/(\w+)_or_(\w+)/);
if (match) { if (match) {
@ -432,7 +432,7 @@
children = parent.children; children = parent.children;
// Find index of mailbox among siblings // Find index of mailbox among siblings
i = _.indexOf(_.pluck(children, 'id'), this.id); i = _.indexOf(_.map(children, 'id'), this.id);
return this.$save().then(function(data) { return this.$save().then(function(data) {
var sibling; var sibling;
@ -446,7 +446,7 @@
return (o.type == 'folder' && o.name.localeCompare(_this.name) > 0); return (o.type == 'folder' && o.name.localeCompare(_this.name) > 0);
}); });
if (sibling) { if (sibling) {
i = _.indexOf(_.pluck(children, 'id'), sibling.id); i = _.indexOf(_.map(children, 'id'), sibling.id);
} }
else { else {
i = children.length; i = children.length;
@ -593,7 +593,7 @@
Mailbox.prototype.$deleteMessages = function(messages) { Mailbox.prototype.$deleteMessages = function(messages) {
var _this = this, uids; var _this = this, uids;
uids = _.pluck(messages, 'uid'); uids = _.map(messages, 'uid');
return Mailbox.$$resource.post(this.id, 'batchDelete', {uids: uids}) return Mailbox.$$resource.post(this.id, 'batchDelete', {uids: uids})
.then(function(data) { .then(function(data) {
// Update inbox quota // Update inbox quota
@ -613,7 +613,7 @@
Mailbox.prototype.$markOrUnMarkMessagesAsJunk = function(messages) { Mailbox.prototype.$markOrUnMarkMessagesAsJunk = function(messages) {
var _this = this, uids; var _this = this, uids;
var method = (this.type == 'junk' ? 'markMessagesAsNotJunk' : 'markMessagesAsJunk'); var method = (this.type == 'junk' ? 'markMessagesAsNotJunk' : 'markMessagesAsJunk');
uids = _.pluck(messages, 'uid'); uids = _.map(messages, 'uid');
return Mailbox.$$resource.post(this.id, method, {uids: uids}); return Mailbox.$$resource.post(this.id, method, {uids: uids});
}; };
@ -644,7 +644,7 @@
Mailbox.prototype.$moveMessages = function(messages, folder) { Mailbox.prototype.$moveMessages = function(messages, folder) {
var _this = this, uids; var _this = this, uids;
uids = _.pluck(messages, 'uid'); uids = _.map(messages, 'uid');
return Mailbox.$$resource.post(this.id, 'moveMessages', {uids: uids, folder: folder}) return Mailbox.$$resource.post(this.id, 'moveMessages', {uids: uids, folder: folder})
.then(function() { .then(function() {
return _this.$_deleteMessages(uids, messages); return _this.$_deleteMessages(uids, messages);
@ -741,7 +741,7 @@
Mailbox.$log.debug('unwrapping ' + data.uids.length + ' messages'); Mailbox.$log.debug('unwrapping ' + data.uids.length + ' messages');
// First entry of 'headers' are keys // First entry of 'headers' are keys
headers = _.invoke(_this.headers[0], 'toLowerCase'); headers = _.invokeMap(_this.headers[0], 'toLowerCase');
_this.headers.splice(0, 1); _this.headers.splice(0, 1);
// First entry of 'uids' are keys when threaded view is enabled // First entry of 'uids' are keys when threaded view is enabled
@ -754,7 +754,7 @@
_.reduce(_this.uids, function(msgs, msg, i) { _.reduce(_this.uids, function(msgs, msg, i) {
var data; var data;
if (_this.threaded) if (_this.threaded)
data = _.object(uids, msg); data = _.zipObject(uids, msg);
else else
data = {uid: msg.toString()}; data = {uid: msg.toString()};
@ -767,8 +767,8 @@
}, _this.$messages); }, _this.$messages);
// Extend Message objects with received headers // Extend Message objects with received headers
_.each(_this.headers, function(data) { _.forEach(_this.headers, function(data) {
var msg = _.object(headers, data), var msg = _.zipObject(headers, data),
i = _this.uidsMap[msg.uid.toString()]; i = _this.uidsMap[msg.uid.toString()];
_.extend(_this.$messages[i], msg); _.extend(_this.$messages[i], msg);
}); });
@ -800,10 +800,10 @@
var headers, j; var headers, j;
if (data.length > 0) { if (data.length > 0) {
// First entry of 'headers' are keys // First entry of 'headers' are keys
headers = _.invoke(data[0], 'toLowerCase'); headers = _.invokeMap(data[0], 'toLowerCase');
data.splice(0, 1); data.splice(0, 1);
_.each(data, function(messageHeaders) { _.forEach(data, function(messageHeaders) {
messageHeaders = _.object(headers, messageHeaders); messageHeaders = _.zipObject(headers, messageHeaders);
j = _this.uidsMap[messageHeaders.uid.toString()]; j = _this.uidsMap[messageHeaders.uid.toString()];
if (angular.isDefined(j)) { if (angular.isDefined(j)) {
_.extend(_this.$messages[j], messageHeaders); _.extend(_this.$messages[j], messageHeaders);

View File

@ -50,7 +50,7 @@
} }
function unselectMessages() { function unselectMessages() {
_.each(vm.selectedFolder.$messages, function(message) { message.selected = false; }); _.forEach(vm.selectedFolder.$messages, function(message) { message.selected = false; });
} }
function confirmDeleteSelectedMessages() { function confirmDeleteSelectedMessages() {
@ -131,7 +131,7 @@
function copySelectedMessages(folder) { function copySelectedMessages(folder) {
var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; }); var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; });
var selectedUIDs = _.pluck(selectedMessages, 'uid'); var selectedUIDs = _.map(selectedMessages, 'uid');
vm.selectedFolder.$copyMessages(selectedUIDs, '/' + folder); vm.selectedFolder.$copyMessages(selectedUIDs, '/' + folder);
} }
@ -150,7 +150,7 @@
function saveSelectedMessages() { function saveSelectedMessages() {
var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; }); var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; });
var selectedUIDs = _.pluck(selectedMessages, 'uid'); var selectedUIDs = _.map(selectedMessages, 'uid');
window.location.href = ApplicationBaseURL + '/' + vm.selectedFolder.id + '/saveMessages?uid=' + selectedUIDs.join(","); window.location.href = ApplicationBaseURL + '/' + vm.selectedFolder.id + '/saveMessages?uid=' + selectedUIDs.join(",");
} }
@ -162,7 +162,7 @@
function markSelectedMessagesAsFlagged() { function markSelectedMessagesAsFlagged() {
var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; }); var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; });
var selectedUIDs = _.pluck(selectedMessages, 'uid'); var selectedUIDs = _.map(selectedMessages, 'uid');
vm.selectedFolder.$flagMessages(selectedUIDs, '\\Flagged', 'add').then(function(d) { vm.selectedFolder.$flagMessages(selectedUIDs, '\\Flagged', 'add').then(function(d) {
// Success // Success
@ -174,7 +174,7 @@
function markSelectedMessagesAsUnread() { function markSelectedMessagesAsUnread() {
var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; }); var selectedMessages = _.filter(vm.selectedFolder.$messages, function(message) { return message.selected; });
var selectedUIDs = _.pluck(selectedMessages, 'uid'); var selectedUIDs = _.map(selectedMessages, 'uid');
vm.selectedFolder.$flagMessages(selectedUIDs, 'seen', 'remove').then(function(d) { vm.selectedFolder.$flagMessages(selectedUIDs, 'seen', 'remove').then(function(d) {
// Success // Success

View File

@ -78,7 +78,7 @@
// Start search // Start search
var root, mailboxes = [], var root, mailboxes = [],
_visit = function(folders) { _visit = function(folders) {
_.each(folders, function(o) { _.forEach(folders, function(o) {
mailboxes.push(o); mailboxes.push(o);
if (o.children && o.children.length > 0) { if (o.children && o.children.length > 0) {
_visit(o.children); _visit(o.children);

View File

@ -156,11 +156,11 @@
*/ */
Message.prototype.$formatFullAddresses = function() { Message.prototype.$formatFullAddresses = function() {
var _this = this; var _this = this;
var identities = _.pluck(_this.$mailbox.$account.identities, 'email'); var identities = _.map(_this.$mailbox.$account.identities, 'email');
// Build long representation of email addresses // Build long representation of email addresses
_.each(['from', 'to', 'cc', 'bcc', 'reply-to'], function(type) { _.forEach(['from', 'to', 'cc', 'bcc', 'reply-to'], function(type) {
_.each(_this[type], function(data) { _.forEach(_this[type], function(data) {
if (data.name && data.name != data.email) { if (data.name && data.name != data.email) {
data.full = data.name + ' <' + data.email + '>'; data.full = data.name + ' <' + data.email + '>';
@ -197,9 +197,9 @@
var _this = this, result = [], count = 0, total = 0; var _this = this, result = [], count = 0, total = 0;
// Build short representation of email addresses // Build short representation of email addresses
_.each(['to', 'cc', 'bcc'], function(type) { _.forEach(['to', 'cc', 'bcc'], function(type) {
total += _this[type]? _this[type].length : 0; total += _this[type]? _this[type].length : 0;
_.each(_this[type], function(data, i) { _.forEach(_this[type], function(data, i) {
if (count < max) if (count < max)
result.push(data.shortname); result.push(data.shortname);
count++; count++;
@ -235,12 +235,12 @@
*/ */
Message.prototype.allowReplyAll = function() { Message.prototype.allowReplyAll = function() {
var recipientsCount = 0; var recipientsCount = 0;
recipientsCount = _.reduce(['to', 'cc'], function(count, type) { recipientsCount = _.reduce(['to', 'cc'], _.bind(function(count, type) {
if (this[type]) if (this[type])
return count + this[type].length; return count + this[type].length;
else else
return count; return count;
}, recipientsCount, this); }, this), recipientsCount);
return !this.isDraft && recipientsCount > 1; return !this.isDraft && recipientsCount > 1;
}; };
@ -281,7 +281,7 @@
message: formattedMessage message: formattedMessage
}; };
} }
_.each(part.content, function(mixedPart) { _.forEach(part.content, function(mixedPart) {
_visit(mixedPart); _visit(mixedPart);
}); });
} }
@ -324,7 +324,7 @@
// UIxMailPartICalViewer injects 'participants' // UIxMailPartICalViewer injects 'participants'
if (part.participants) { if (part.participants) {
_.each(part.participants, function(participant) { _.forEach(part.participants, function(participant) {
participant.image = Message.$gravatar(participant.email, 32); participant.image = Message.$gravatar(participant.email, 32);
}); });
} }

View File

@ -21,7 +21,7 @@
vm.send = send; vm.send = send;
vm.removeAttachment = removeAttachment; vm.removeAttachment = removeAttachment;
vm.contactFilter = contactFilter; vm.contactFilter = contactFilter;
vm.identities = _.pluck(_.flatten(_.pluck(stateAccounts, 'identities')), 'full'); vm.identities = _.map(_.flatten(_.map(stateAccounts, 'identities')), 'full');
vm.recipientSeparatorKeys = [$mdConstant.KEY_CODE.ENTER, $mdConstant.KEY_CODE.TAB, $mdConstant.KEY_CODE.COMMA, semicolon]; vm.recipientSeparatorKeys = [$mdConstant.KEY_CODE.ENTER, $mdConstant.KEY_CODE.TAB, $mdConstant.KEY_CODE.COMMA, semicolon];
vm.uploader = new FileUploader({ vm.uploader = new FileUploader({
url: stateMessage.$absolutePath({asDraft: true}) + '/save', url: stateMessage.$absolutePath({asDraft: true}) + '/save',
@ -80,7 +80,7 @@
} }
if (angular.isDefined(stateRecipients)) { if (angular.isDefined(stateRecipients)) {
vm.message.editable.to = _.union(vm.message.editable.to, _.pluck(stateRecipients, 'full')); vm.message.editable.to = _.union(vm.message.editable.to, _.map(stateRecipients, 'full'));
} }
/** /**
@ -215,7 +215,7 @@
if (contact.$isList()) { if (contact.$isList()) {
// If the list's members were already fetch, use them // If the list's members were already fetch, use them
if (angular.isDefined(contact.refs) && contact.refs.length) { if (angular.isDefined(contact.refs) && contact.refs.length) {
_.each(contact.refs, function(ref) { _.forEach(contact.refs, function(ref) {
if (ref.email.length) if (ref.email.length)
recipients.push(ref.$shortFormat()); recipients.push(ref.$shortFormat());
}); });

View File

@ -74,7 +74,7 @@
VirtualMailbox.prototype.setMailboxes = function(data) { VirtualMailbox.prototype.setMailboxes = function(data) {
this.$mailboxes = data; this.$mailboxes = data;
_.each(this.$mailboxes, function(mailbox) { _.forEach(this.$mailboxes, function(mailbox) {
mailbox.$messages = []; mailbox.$messages = [];
mailbox.uidsMap = {}; mailbox.uidsMap = {};
}); });
@ -86,7 +86,7 @@
this.$isLoading = true; this.$isLoading = true;
_.each(this.$mailboxes, function(mailbox) { _.forEach(this.$mailboxes, function(mailbox) {
search = search.then(function() { search = search.then(function() {
if (_this.$isLoading) { if (_this.$isLoading) {
VirtualMailbox.$log.debug("searching mailbox " + mailbox.path); VirtualMailbox.$log.debug("searching mailbox " + mailbox.path);
@ -109,7 +109,7 @@
* @desc Delete 'selectedMessage' attribute of all submailboxes. * @desc Delete 'selectedMessage' attribute of all submailboxes.
*/ */
VirtualMailbox.prototype.resetSelectedMessage = function() { VirtualMailbox.prototype.resetSelectedMessage = function() {
_.each(this.$mailboxes, function(mailbox) { _.forEach(this.$mailboxes, function(mailbox) {
delete mailbox.selectedMessage; delete mailbox.selectedMessage;
}); });
}; };
@ -140,7 +140,7 @@
if (!angular.isDefined(this.$mailboxes)) if (!angular.isDefined(this.$mailboxes))
return len; return len;
_.each(this.$mailboxes, function(mailbox) { _.forEach(this.$mailboxes, function(mailbox) {
len += mailbox.$messages.length; len += mailbox.$messages.length;
}); });

View File

@ -15,7 +15,7 @@
this.defaultsPromise = Preferences.$$resource.fetch("jsonDefaults").then(function(data) { this.defaultsPromise = Preferences.$$resource.fetch("jsonDefaults").then(function(data) {
// We swap $key -> _$key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266) // We swap $key -> _$key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)
var labels = _.object(_.map(data.SOGoMailLabelsColors, function(value, key) { var labels = _.zipObject(_.map(data.SOGoMailLabelsColors, function(value, key) {
if (key.charAt(0) == '$') if (key.charAt(0) == '$')
return ['_' + key, value]; return ['_' + key, value];
return [key, value]; return [key, value];
@ -197,7 +197,7 @@
}); });
// We swap _$key -> $key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266) // We swap _$key -> $key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)
labels = _.object(_.map(preferences.defaults.SOGoMailLabelsColors, function(value, key) { labels = _.zipObject(_.map(preferences.defaults.SOGoMailLabelsColors, function(value, key) {
if (key.charAt(0) == '_' && key.charAt(1) == '$') { if (key.charAt(0) == '_' && key.charAt(1) == '$') {
// New key, let's take the value and flatten it // New key, let's take the value and flatten it
if (key.length > 2 && key.charAt(2) == '$') { if (key.length > 2 && key.charAt(2) == '$') {
@ -230,7 +230,7 @@
preferences.defaults.Forward.forwardAddress = preferences.defaults.Forward.forwardAddress.split(","); preferences.defaults.Forward.forwardAddress = preferences.defaults.Forward.forwardAddress.split(",");
if (preferences.settings.Calendar && preferences.settings.Calendar.PreventInvitationsWhitelist) { if (preferences.settings.Calendar && preferences.settings.Calendar.PreventInvitationsWhitelist) {
_.each(preferences.settings.Calendar.PreventInvitationsWhitelist, function(user) { _.forEach(preferences.settings.Calendar.PreventInvitationsWhitelist, function(user) {
whitelist[user.uid] = user.$shortFormat(); whitelist[user.uid] = user.$shortFormat();
}); });
preferences.settings.Calendar.PreventInvitationsWhitelist = whitelist; preferences.settings.Calendar.PreventInvitationsWhitelist = whitelist;

View File

@ -97,7 +97,7 @@
(o.id != 'personal' && (o.id != 'personal' &&
o.name.localeCompare(calendar.name) === 1)); o.name.localeCompare(calendar.name) === 1));
}); });
i = sibling ? _.indexOf(_.pluck(list, 'id'), sibling.id) : 1; i = sibling ? _.indexOf(_.map(list, 'id'), sibling.id) : 1;
list.splice(i, 0, calendar); list.splice(i, 0, calendar);
}; };
@ -168,11 +168,11 @@
Calendar.$getIndex = function(id) { Calendar.$getIndex = function(id) {
var i; var i;
i = _.indexOf(_.pluck(Calendar.$calendars, 'id'), id); i = _.indexOf(_.map(Calendar.$calendars, 'id'), id);
if (i < 0) if (i < 0)
i = _.indexOf(_.pluck(Calendar.$subscriptions, 'id'), id); i = _.indexOf(_.map(Calendar.$subscriptions, 'id'), id);
if (i < 0) if (i < 0)
i = _.indexOf(_.pluck(Calendar.$webcalendars, 'id'), id); i = _.indexOf(_.map(Calendar.$webcalendars, 'id'), id);
return i; return i;
}; };
@ -335,7 +335,7 @@
else else
calendars = Calendar.$calendars; calendars = Calendar.$calendars;
i = _.indexOf(_.pluck(calendars, 'id'), this.id); i = _.indexOf(_.map(calendars, 'id'), this.id);
if (i > -1) { if (i > -1) {
return this.$save().then(function() { return this.$save().then(function() {
calendars.splice(i, 1); calendars.splice(i, 1);
@ -371,7 +371,7 @@
} }
return promise.then(function() { return promise.then(function() {
var i = _.indexOf(_.pluck(list, 'id'), _this.id); var i = _.indexOf(_.map(list, 'id'), _this.id);
list.splice(i, 1); list.splice(i, 1);
}); });
}; };

View File

@ -59,11 +59,11 @@
} }
function unselectComponents() { function unselectComponents() {
_.each(Component['$' + vm.componentType], function(component) { component.selected = false; }); _.forEach(Component['$' + vm.componentType], function(component) { component.selected = false; });
} }
function selectAll() { function selectAll() {
_.each(Component['$' + vm.componentType], function(component) { _.forEach(Component['$' + vm.componentType], function(component) {
component.selected = true; component.selected = true;
}); });
} }

View File

@ -49,10 +49,10 @@
}, },
function(newList, oldList) { function(newList, oldList) {
// Identify which calendar has changed // Identify which calendar has changed
var ids = _.pluck(_.filter(newList, function(o, i) { return !_.isEqual(o, oldList[i]); }), 'id'); var ids = _.map(_.filter(newList, function(o, i) { return !_.isEqual(o, oldList[i]); }), 'id');
if (ids.length > 0) { if (ids.length > 0) {
$log.debug(ids.join(', ') + ' changed'); $log.debug(ids.join(', ') + ' changed');
_.each(ids, function(id) { _.forEach(ids, function(id) {
var calendar = Calendar.$get(id); var calendar = Calendar.$get(id);
calendar.$setActivation().then(function() { calendar.$setActivation().then(function() {
$rootScope.$emit('calendars:list'); $rootScope.$emit('calendars:list');
@ -304,8 +304,6 @@
folder.$rename() folder.$rename()
.then(function(data) { .then(function(data) {
vm.editMode = false; vm.editMode = false;
}, function(data, status) {
Dialog.alert(l('Warning'), data);
}); });
} }

View File

@ -158,7 +158,7 @@
angular.extend(_this.$query, params); angular.extend(_this.$query, params);
if (options) { if (options) {
_.each(_.keys(options), function(key) { _.forEach(_.keys(options), function(key) {
// Query parameters common to events and tasks are compared // Query parameters common to events and tasks are compared
dirty |= (_this.$query[key] && options[key] != Component.$query[key]); dirty |= (_this.$query[key] && options[key] != Component.$query[key]);
if (key == 'reload' && options[key]) if (key == 'reload' && options[key])
@ -291,7 +291,7 @@
var reduceComponent, associateComponent; var reduceComponent, associateComponent;
reduceComponent = function(objects, eventData, i) { reduceComponent = function(objects, eventData, i) {
var componentData = _.object(this.eventsFields, eventData), var componentData = _.zipObject(this.eventsFields, eventData),
start = new Date(componentData.c_startdate * 1000); start = new Date(componentData.c_startdate * 1000);
componentData.hour = start.getHourString(); componentData.hour = start.getHourString();
componentData.blocks = []; componentData.blocks = [];
@ -316,13 +316,13 @@
data.eventsFields.splice(_.indexOf(data.eventsFields, 'c_title'), 1, 'summary'); data.eventsFields.splice(_.indexOf(data.eventsFields, 'c_title'), 1, 'summary');
// Instantiate Component objects // Instantiate Component objects
_.reduce(data.events, reduceComponent, components, data); _.reduce(data.events, _.bind(reduceComponent, data), components);
// Associate Component objects to blocks positions // Associate Component objects to blocks positions
_.forEach(_.flatten(data.blocks), associateComponent, components); _.forEach(_.flatten(data.blocks), _.bind(associateComponent, components));
// Associate Component objects to all-day blocks positions // Associate Component objects to all-day blocks positions
_.each(_.flatten(data.allDayBlocks), associateComponent, components); _.forEach(_.flatten(data.allDayBlocks), _.bind(associateComponent, components));
// Build array of dates // Build array of dates
if (dates.length === 0) if (dates.length === 0)
@ -392,14 +392,14 @@
return futureComponentData.then(function(data) { return futureComponentData.then(function(data) {
return Component.$timeout(function() { return Component.$timeout(function() {
var fields = _.invoke(data.fields, 'toLowerCase'); var fields = _.invokeMap(data.fields, 'toLowerCase');
fields.splice(_.indexOf(fields, 'c_folder'), 1, 'pid'); fields.splice(_.indexOf(fields, 'c_folder'), 1, 'pid');
fields.splice(_.indexOf(fields, 'c_name'), 1, 'id'); fields.splice(_.indexOf(fields, 'c_name'), 1, 'id');
fields.splice(_.indexOf(fields, 'c_recurrence_id'), 1, 'occurrenceId'); fields.splice(_.indexOf(fields, 'c_recurrence_id'), 1, 'occurrenceId');
// Instanciate Component objects // Instanciate Component objects
_.reduce(data[type], function(components, componentData, i) { _.reduce(data[type], function(components, componentData, i) {
var data = _.object(fields, componentData); var data = _.zipObject(fields, componentData);
components.push(new Component(data)); components.push(new Component(data));
return components; return components;
}, components); }, components);
@ -498,7 +498,7 @@
this.due = Component.$parseDate(this.dueDate); this.due = Component.$parseDate(this.dueDate);
if (this.c_category) if (this.c_category)
this.categories = _.invoke(this.c_category, 'asCSSIdentifier'); this.categories = _.invokeMap(this.c_category, 'asCSSIdentifier');
// Parse recurrence rule definition and initialize default values // Parse recurrence rule definition and initialize default values
this.$isRecurrent = angular.isDefined(data.repeat); this.$isRecurrent = angular.isDefined(data.repeat);
@ -680,7 +680,7 @@
roundedStart.setMinutes(15*startQuarter); roundedStart.setMinutes(15*startQuarter);
roundedEnd.setMinutes(15*endQuarter); roundedEnd.setMinutes(15*endQuarter);
_.each(roundedStart.daysUpTo(roundedEnd), function(date, index) { _.forEach(roundedStart.daysUpTo(roundedEnd), function(date, index) {
var currentDay = date.getDate(), var currentDay = date.getDate(),
dayKey = date.getDayString(), dayKey = date.getDayString(),
hourKey; hourKey;
@ -721,7 +721,7 @@
this.freebusy = this.updateFreeBusyCoverage(); this.freebusy = this.updateFreeBusyCoverage();
if (this.attendees) { if (this.attendees) {
_.each(this.attendees, function(attendee) { _.forEach(this.attendees, function(attendee) {
attendee.image = Component.$gravatar(attendee.email, 32); attendee.image = Component.$gravatar(attendee.email, 32);
_this.updateFreeBusyAttendee(attendee); _this.updateFreeBusyAttendee(attendee);
}); });
@ -763,7 +763,7 @@
// Fetch FreeBusy information // Fetch FreeBusy information
Component.$$resource.fetch(url.join('/'), 'ajaxRead', params).then(function(data) { Component.$$resource.fetch(url.join('/'), 'ajaxRead', params).then(function(data) {
_.each(days, function(day) { _.forEach(days, function(day) {
var hour; var hour;
if (angular.isUndefined(attendee.freebusy[day])) if (angular.isUndefined(attendee.freebusy[day]))

View File

@ -1,6 +1,7 @@
/** /**
* @license * @license
* lodash 4.6.1 <https://lodash.com/> * lodash 4.6.1 (Custom Build) <https://lodash.com/>
* Build: `lodash -o ./dist/lodash.js`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors