From 2e9c8497c0bb8c1969db51b4fce5ebbc2888f25d Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Thu, 21 Apr 2016 11:21:26 +0000 Subject: [PATCH] Don't try to update tasks if they don't have an ID If the task in the webclient doesn't have an ID, it can't be updated (obviously). Don't try to update the task in this case. This patch fixes an error that would arise when setting the status of a task when creating it on the story detail view. Change-Id: I0e02ef1a926cc0513d6a8dd85d66e4462e2ce76c --- src/app/stories/controller/story_detail_controller.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/stories/controller/story_detail_controller.js b/src/app/stories/controller/story_detail_controller.js index 4a0c44e7..97785c27 100644 --- a/src/app/stories/controller/story_detail_controller.js +++ b/src/app/stories/controller/story_detail_controller.js @@ -360,10 +360,12 @@ angular.module('sb.story').controller('StoryDetailController', task[fieldName] = value; } - task.$update(function () { - $scope.showTaskEditForm = false; - $scope.loadEvents(); - }); + if(!!task.id) { + task.$update(function () { + $scope.showTaskEditForm = false; + $scope.loadEvents(); + }); + } }; /**