(js) Enable new calendar subscriptions by default
parent
9e152adc7d
commit
5aa19ebfb7
3
NEWS
3
NEWS
|
@ -43,6 +43,9 @@ Bug fixes
|
|||
- [web] fixed unseen count retrieval of nested IMAP folders
|
||||
- [web] properly extract the mail column values from an SQL contacts source (#3544)
|
||||
- [web] fixed incorrect date formatting when timezone was after UTC+0 (#3481, #3494)
|
||||
- [web] replaced checkboxes in menu by a custom checkmark (#3557)
|
||||
- [web] fixed attachments display when forwarding a message (#3560)
|
||||
- [web] activate new calendar subscriptions by default
|
||||
- [eas] allow EAS attachments get on 2nd-level mailboxes (#3505)
|
||||
- [eas] fix EAS bday shift (#3518)
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
Calendar.$subscribe = function(uid, path) {
|
||||
var _this = this;
|
||||
return Calendar.$$resource.userResource(uid).fetch(path, 'subscribe').then(function(calendarData) {
|
||||
var calendar = new Calendar(calendarData);
|
||||
var calendar = new Calendar(angular.extend({ active: 1 }, calendarData));
|
||||
if (!_.find(_this.$subscriptions, function(o) {
|
||||
return o.id == calendarData.id;
|
||||
})) {
|
||||
|
|
|
@ -48,17 +48,27 @@
|
|||
);
|
||||
},
|
||||
function(newList, oldList) {
|
||||
var commonList, ids, promises;
|
||||
|
||||
// Identify which calendar has changed
|
||||
var ids = _.map(_.filter(newList, function(o, i) { return !_.isEqual(o, oldList[i]); }), 'id');
|
||||
commonList = _.intersectionBy(newList, oldList, 'id');
|
||||
ids = _.map(_.filter(commonList, function(o) {
|
||||
var oldObject = _.find(oldList, { id: o.id });
|
||||
return !_.isEqual(o, oldObject);
|
||||
}), 'id');
|
||||
promises = [];
|
||||
|
||||
if (ids.length > 0) {
|
||||
$log.debug(ids.join(', ') + ' changed');
|
||||
_.forEach(ids, function(id) {
|
||||
var calendar = Calendar.$get(id);
|
||||
calendar.$setActivation().then(function() {
|
||||
$rootScope.$emit('calendars:list');
|
||||
});
|
||||
promises.push(calendar.$setActivation());
|
||||
});
|
||||
}
|
||||
if (commonList.length > 0)
|
||||
Calendar.$q.all(promises).then(function() {
|
||||
$rootScope.$emit('calendars:list');
|
||||
});
|
||||
},
|
||||
true // compare for object equality
|
||||
);
|
||||
|
@ -91,9 +101,7 @@
|
|||
if (folder.isSubscription) {
|
||||
// Unsubscribe without confirmation
|
||||
folder.$delete()
|
||||
.then(function() {
|
||||
$rootScope.$emit('calendars:list');
|
||||
}, function(data, status) {
|
||||
.catch(function(data, status) {
|
||||
Dialog.alert(l('An error occured while deleting the calendar "%{0}".', folder.name),
|
||||
l(data.error));
|
||||
});
|
||||
|
@ -103,9 +111,7 @@
|
|||
{ ok: l('Delete') })
|
||||
.then(function() {
|
||||
folder.$delete()
|
||||
.then(function() {
|
||||
$rootScope.$emit('calendars:list');
|
||||
}, function(data, status) {
|
||||
.catch(function(data, status) {
|
||||
Dialog.alert(l('An error occured while deleting the calendar "%{0}".', folder.name),
|
||||
l(data.error));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue