Index: src/applications/maniphest/controller/ManiphestTaskEditController.php =================================================================== --- src/applications/maniphest/controller/ManiphestTaskEditController.php +++ src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -49,9 +49,49 @@ $task->setTitle($request->getStr('title')); if ($can_edit_projects) { - $default_projects = $request->getStr('projects'); - if ($default_projects) { - $task->setProjectPHIDs(explode(';', $default_projects)); + $projects = $request->getStr('projects'); + if ($projects) { + $tokens = explode(';', $projects); + + $slug_map = id(new PhabricatorProjectQuery()) + ->setViewer($user) + ->withPhrictionSlugs($tokens) + ->execute(); + + $name_map = id(new PhabricatorProjectQuery()) + ->setViewer($user) + ->withNames($tokens) + ->execute(); + + $phid_map = id(new PhabricatorProjectQuery()) + ->setViewer($user) + ->withPHIDs($tokens) + ->execute(); + + $all_map = mpull($slug_map, null, 'getPhrictionSlug') + + mpull($name_map, null, 'getName') + + mpull($phid_map, null, 'getPHID'); + + $default_projects = array(); + foreach ($tokens as $token) { + if (isset($all_map[$token])) { + $default_projects[] = $all_map[$token]->getPHID(); + } + } + + if ($default_projects) { + $task->setProjectPHIDs($default_projects); + } + } + } + + if ($can_edit_priority) { + $priority = $request->getInt('priority'); + if ($priority !== null) { + $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); + if (isset($priority_map[$priority])) { + $task->setPriority($priority); + } } } Index: src/applications/project/query/PhabricatorProjectQuery.php =================================================================== --- src/applications/project/query/PhabricatorProjectQuery.php +++ src/applications/project/query/PhabricatorProjectQuery.php @@ -7,6 +7,7 @@ private $phids; private $memberPHIDs; private $slugs; + private $names; private $status = 'status-any'; const STATUS_ANY = 'status-any'; @@ -43,6 +44,11 @@ return $this; } + public function withNames(array $names) { + $this->names = $names; + return $this; + } + public function needMembers($need_members) { $this->needMembers = $need_members; return $this; @@ -224,6 +230,13 @@ $this->slugs); } + if ($this->names) { + $where[] = qsprintf( + $conn_r, + 'name IN (%Ls)', + $this->names); + } + $where[] = $this->buildPagingClause($conn_r); return $this->formatWhereClause($where);