From 699fe537e1cc89fbe2f67c379622e17664f1fe03 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 31 Aug 2018 13:18:32 -0400 Subject: [PATCH] (js) Fix error when reseting Calendar data --- UI/WebServerResources/js/Scheduler/Calendar.service.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/UI/WebServerResources/js/Scheduler/Calendar.service.js b/UI/WebServerResources/js/Scheduler/Calendar.service.js index 38199a1b4..fc5428ecb 100644 --- a/UI/WebServerResources/js/Scheduler/Calendar.service.js +++ b/UI/WebServerResources/js/Scheduler/Calendar.service.js @@ -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(); }); } };