(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] colorize categories chips in event and task viewers
- [web] initial stylesheet for printing
- [web] updated lodash to version 4.6.1
- [eas] now support EAS MIME truncation
Bug fixes

View File

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

View File

@ -81,7 +81,7 @@
var _this = this,
deferred = Acl.$q.defer(),
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
deferred.resolve();
}
@ -116,7 +116,7 @@
var _this = this,
param = {uid: uid};
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) {
_this.users.splice(i, 1);
}

View File

@ -77,7 +77,7 @@
if (excludedUsers) {
// Remove excluded users from response
results = _.filter(response.users, function(user) {
return !_.find(excludedUsers, compareUids, user);
return !_.find(excludedUsers, _.bind(compareUids, user));
});
}
else {
@ -87,13 +87,13 @@
// Remove users that no longer match the search query
for (index = users.length - 1; index >= 0; index--) {
user = users[index];
if (!_.find(results, compareUids, user)) {
if (!_.find(results, _.bind(compareUids, user))) {
users.splice(index, 1);
}
}
// Add new users matching the search query
_.each(results, function(data, index) {
if (_.isUndefined(_.find(users, compareUids, data))) {
_.forEach(results, function(data, index) {
if (_.isUndefined(_.find(users, _.bind(compareUids, data)))) {
var user = new User(data);
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');
});
//$log.debug(_.pluck(customSheet.cssRules, 'cssText').join("\n"));
//$log.debug(_.map(customSheet.cssRules, 'cssText').join("\n"));
});
function addRule(fgInterpolate, bgInterpolate, themeName, paletteName, colorArray, hueName){

View File

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

View File

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

View File

@ -78,7 +78,7 @@
if (form.$valid) {
vm.card.$save()
.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) {
// New card; reload contacts list and show addressbook in which the card has been created
AddressBook.selectedFolder.$reload();

View File

@ -12,7 +12,7 @@
// Data is immediately available
if (typeof futureAccountData.then !== 'function') {
angular.extend(this, futureAccountData);
_.each(this.identities, function(identity) {
_.forEach(this.identities, function(identity) {
if (identity.fullName)
identity.full = identity.fullName + ' <' + identity.email + '>';
else
@ -147,7 +147,7 @@
allMailboxes = [],
expandedMailboxes = [],
_visit = function(mailboxes) {
_.each(mailboxes, function(o) {
_.forEach(mailboxes, function(o) {
allMailboxes.push(o);
if ((options && options.all || o.$expanded) && o.children && o.children.length > 0) {
_visit(o.children);
@ -291,7 +291,7 @@
var _this = this,
deferred = Account.$q.defer(),
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
deferred.resolve();
}
@ -317,7 +317,7 @@
var _this = this,
param = {uid: uid};
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) {
_this.delegates.splice(i, 1);
}

View File

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

View File

@ -50,7 +50,7 @@
}
function unselectMessages() {
_.each(vm.selectedFolder.$messages, function(message) { message.selected = false; });
_.forEach(vm.selectedFolder.$messages, function(message) { message.selected = false; });
}
function confirmDeleteSelectedMessages() {
@ -131,7 +131,7 @@
function copySelectedMessages(folder) {
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);
}
@ -150,7 +150,7 @@
function saveSelectedMessages() {
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(",");
}
@ -162,7 +162,7 @@
function markSelectedMessagesAsFlagged() {
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) {
// Success
@ -174,7 +174,7 @@
function markSelectedMessagesAsUnread() {
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) {
// Success

View File

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

View File

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

View File

@ -21,7 +21,7 @@
vm.send = send;
vm.removeAttachment = removeAttachment;
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.uploader = new FileUploader({
url: stateMessage.$absolutePath({asDraft: true}) + '/save',
@ -80,7 +80,7 @@
}
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 the list's members were already fetch, use them
if (angular.isDefined(contact.refs) && contact.refs.length) {
_.each(contact.refs, function(ref) {
_.forEach(contact.refs, function(ref) {
if (ref.email.length)
recipients.push(ref.$shortFormat());
});

View File

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

View File

@ -15,7 +15,7 @@
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)
var labels = _.object(_.map(data.SOGoMailLabelsColors, function(value, key) {
var labels = _.zipObject(_.map(data.SOGoMailLabelsColors, function(value, key) {
if (key.charAt(0) == '$')
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)
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) == '$') {
// New key, let's take the value and flatten it
if (key.length > 2 && key.charAt(2) == '$') {
@ -230,7 +230,7 @@
preferences.defaults.Forward.forwardAddress = preferences.defaults.Forward.forwardAddress.split(",");
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();
});
preferences.settings.Calendar.PreventInvitationsWhitelist = whitelist;

View File

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

View File

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

View File

@ -49,10 +49,10 @@
},
function(newList, oldList) {
// 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) {
$log.debug(ids.join(', ') + ' changed');
_.each(ids, function(id) {
_.forEach(ids, function(id) {
var calendar = Calendar.$get(id);
calendar.$setActivation().then(function() {
$rootScope.$emit('calendars:list');
@ -304,8 +304,6 @@
folder.$rename()
.then(function(data) {
vm.editMode = false;
}, function(data, status) {
Dialog.alert(l('Warning'), data);
});
}

View File

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

View File

@ -1,6 +1,7 @@
/**
* @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/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors