(js) Fix error when reseting Calendar data

pull/229/merge
Francis Lachapelle 2018-08-31 13:18:32 -04:00
parent 35cd2591d6
commit 699fe537e1
1 changed files with 5 additions and 3 deletions

View File

@ -373,7 +373,7 @@
// Add 'isOwned' and 'isSubscription' attributes based on active user (TODO: add it server-side?)
this.isOwned = Calendar.activeUser.isSuperUser || this.owner == Calendar.activeUser.login;
this.isSubscription = !this.isRemote && this.owner != Calendar.activeUser.login;
if (angular.isUndefined(this.$shadowData)) {
if (angular.isUndefined(this.$shadowData) || !this.$shadowData.id) {
// Make a copy of the data for an eventual reset
this.$shadowData = this.$omit();
}
@ -395,8 +395,10 @@
else {
// Wait until object is unwrapped
return this.$futureCalendarData.then(function(calendar) {
_this.id = calendar.id;
return calendar.id;
if (calendar.id)
return calendar.id;
else
return Calendar.$q.reject();
});
}
};