From cfb8f9e3df22ad517cbb5be734e182c2475c3498 Mon Sep 17 00:00:00 2001 From: Adam Coldrick Date: Tue, 23 Oct 2018 19:42:14 +0100 Subject: [PATCH] Handle project names in the new Story modal controller This commit fixes a bug where passing a project name as the project ID in the new Story modal led to the API returning an error when trying to create the first task. The fix is to first GET the project from the name, and then use the ID returned by the API. Change-Id: I7af9b1e4b10c9c525947243bef82aca1519b07e3 Story: 2003650 Task: 26061 Story: 2004098 Task: 27501 --- src/app/stories/controller/story_modal_controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/stories/controller/story_modal_controller.js b/src/app/stories/controller/story_modal_controller.js index 3079bf4c..5701ee26 100644 --- a/src/app/stories/controller/story_modal_controller.js +++ b/src/app/stories/controller/story_modal_controller.js @@ -35,8 +35,7 @@ angular.module('sb.story').controller('StoryModalController', }); $scope.tasks = [new Task({ - title: '', - project_id: params.projectId || null + title: '' })]; // Preload the project @@ -45,6 +44,10 @@ angular.module('sb.story').controller('StoryModalController', id: params.projectId }, function (project) { $scope.asyncProject = project; + $scope.tasks = [new Task({ + title: '', + project_id: project.id + })]; }); }