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
This commit is contained in:
Adam Coldrick 2018-10-23 19:42:14 +01:00
parent 8e46f40a74
commit cfb8f9e3df
1 changed files with 5 additions and 2 deletions

View File

@ -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
})];
});
}