diff --git a/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php b/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php index b4996f0a06..9e35a4a307 100644 --- a/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/taskedit/ManiphestTaskEditController.php @@ -47,6 +47,11 @@ class ManiphestTaskEditController extends ManiphestController { // These allow task creation with defaults. if (!$request->isFormPost()) { $task->setTitle($request->getStr('title')); + + $default_projects = $request->getStr('projects'); + if ($default_projects) { + $task->setProjectPHIDs(explode(';', $default_projects)); + } } $file_phids = $request->getArr('files', array()); diff --git a/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php b/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php index 7303c65dd2..23f048fcb5 100644 --- a/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php @@ -176,12 +176,19 @@ class ManiphestTaskListController extends ManiphestController { id(new AphrontFormSubmitControl()) ->setValue('Filter Tasks')); + $create_uri = new PhutilURI('/maniphest/task/create/'); + if ($project_phids) { + // If we have project filters selected, use them as defaults for task + // creation. + $create_uri->setQueryParam('projects', implode(';', $project_phids)); + } + $filter = new AphrontListFilterView(); $filter->addButton( phutil_render_tag( 'a', array( - 'href' => '/maniphest/task/create/', + 'href' => (string)$create_uri, 'class' => 'green button', ), 'Create New Task')); diff --git a/src/applications/maniphest/controller/tasklist/__init__.php b/src/applications/maniphest/controller/tasklist/__init__.php index 28c7ec5a4c..87bd5495f9 100644 --- a/src/applications/maniphest/controller/tasklist/__init__.php +++ b/src/applications/maniphest/controller/tasklist/__init__.php @@ -23,6 +23,7 @@ phutil_require_module('phabricator', 'view/layout/listfilter'); phutil_require_module('phabricator', 'view/layout/sidenav'); phutil_require_module('phutil', 'markup'); +phutil_require_module('phutil', 'parser/uri'); phutil_require_module('phutil', 'utils');