1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

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
This commit is contained in:
epriestley 2014-04-15 11:17:37 -07:00
parent 20abf37b88
commit 041c3fd19d

View file

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