parent
f70c0fa6e6
commit
9cc4bfd9be
1
NEWS
1
NEWS
|
@ -21,6 +21,7 @@ Bug fixes
|
|||
- [web] fixed virtual repeater when moving up in messages list
|
||||
- [web] really delete mailboxes being deleted from the Trash folder (#595, #1189, #641)
|
||||
- [web] fixed address autocompletion of mail editor affecting cards list of active addressbook
|
||||
- [web] fixed batched delete of components (#3516)
|
||||
|
||||
3.0.1 (2016-02-05)
|
||||
------------------
|
||||
|
|
|
@ -243,25 +243,19 @@
|
|||
* @return a promise of the HTTP operation
|
||||
*/
|
||||
Calendar.$deleteComponents = function(components) {
|
||||
|
||||
// We create a c_folder -> event hash
|
||||
var calendars = {}, _this = this;
|
||||
var _this = this, calendars = {}, promises = [];
|
||||
|
||||
_.forEach(components, function(component) {
|
||||
if (!angular.isDefined(calendars[component.c_folder]))
|
||||
calendars[component.c_folder] = [];
|
||||
|
||||
calendars[component.c_folder].push(component.c_name);
|
||||
if (!angular.isDefined(calendars[component.pid]))
|
||||
calendars[component.pid] = [];
|
||||
calendars[component.pid].push(component.id);
|
||||
});
|
||||
|
||||
_.forEach(calendars, function(uids, c_folder) {
|
||||
Calendar.$$resource.post(c_folder, 'batchDelete', {uids: uids});
|
||||
_.forEach(calendars, function(uids, pid) {
|
||||
promises.push(Calendar.$$resource.post(pid, 'batchDelete', {uids: uids}));
|
||||
});
|
||||
|
||||
// We slice both arrays - might be useful if in the future, we can delete
|
||||
// events and tasks at the same time.
|
||||
_this.$Component.$events = _.difference(_this.$Component.$events, components);
|
||||
_this.$Component.$tasks = _.difference(_this.$Component.$tasks, components);
|
||||
return Calendar.$q.all(promises);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -80,8 +80,12 @@
|
|||
{ ok: l('Delete') })
|
||||
.then(function() {
|
||||
// User confirmed the deletion
|
||||
var components = _.filter(Component['$' + vm.componentType], function(component) { return component.selected; });
|
||||
Calendar.$deleteComponents(components);
|
||||
var components = _.filter(Component['$' + vm.componentType], function(component) {
|
||||
return component.selected;
|
||||
});
|
||||
Calendar.$deleteComponents(components).then(function() {
|
||||
$rootScope.$emit('calendars:list');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue