From 041c3fd19d204954c742d09a4a959d46b11eee74 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 15 Apr 2014 11:17:37 -0700 Subject: [PATCH] Let project prefilling accept PHIDs Summary: I recently made this better about accepting project names, but we use it in some cases with PHIDs. Make that work properly again. Test Plan: Clicked "New Task" from a project page. Reviewers: chad, btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D8778 --- .../controller/ManiphestTaskEditController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php index 8ecd438cce..1f8451b839 100644 --- a/src/applications/maniphest/controller/ManiphestTaskEditController.php +++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php @@ -58,7 +58,19 @@ final class ManiphestTaskEditController extends ManiphestController { if ($projects) { $tokens = $request->getStrList('projects'); + $type_project = PhabricatorProjectPHIDTypeProject::TYPECONST; foreach ($tokens as $key => $token) { + if (phid_get_type($token) == $type_project) { + // If this is formatted like a PHID, leave it as-is. + continue; + } + + if (preg_match('/^#/', $token)) { + // If this already has a "#", leave it as-is. + continue; + } + + // Add a "#" prefix. $tokens[$key] = '#'.$token; }