diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php index c9594122d8..b1aab1e417 100644 --- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php +++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php @@ -169,11 +169,12 @@ final class PhabricatorProjectTransactionEditor case PhabricatorProjectTransaction::TYPE_NAME: // First, add the old name as a secondary slug; this is helpful // for renames and generally a good thing to do. - if ($old !== null) { - $this->addSlug($object, $old, false); + if (!$this->getIsMilestone()) { + if ($old !== null) { + $this->addSlug($object, $old, false); + } + $this->addSlug($object, $new, false); } - $this->addSlug($object, $new, false); - return; case PhabricatorProjectTransaction::TYPE_SLUGS: $old = $xaction->getOldValue(); diff --git a/src/applications/project/typeahead/PhabricatorProjectDatasource.php b/src/applications/project/typeahead/PhabricatorProjectDatasource.php index 33fb8df0e9..40d8dbb0e6 100644 --- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php +++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php @@ -38,6 +38,8 @@ final class PhabricatorProjectDatasource $query->withIsMilestone(false); } + $for_autocomplete = $this->getParameter('autocomplete'); + $projs = $this->executeQuery($query); $projs = mpull($projs, null, 'getPHID'); @@ -58,6 +60,23 @@ final class PhabricatorProjectDatasource if (!isset($has_cols[$proj->getPHID()])) { continue; } + + $slug = $proj->getPrimarySlug(); + if (!strlen($slug)) { + foreach ($proj->getSlugs() as $slug_object) { + $slug = $slug_object->getSlug(); + if (strlen($slug)) { + break; + } + } + } + + // If we're building results for the autocompleter and this project + // doesn't have any usable slugs, don't return it as a result. + if ($for_autocomplete && !strlen($slug)) { + continue; + } + $closed = null; if ($proj->isArchived()) { $closed = pht('Archived'); @@ -78,7 +97,6 @@ final class PhabricatorProjectDatasource ->setPriorityType('proj') ->setClosed($closed); - $slug = $proj->getPrimarySlug(); if (strlen($slug)) { $proj_result->setAutocomplete('#'.$slug); } diff --git a/src/view/form/control/PhabricatorRemarkupControl.php b/src/view/form/control/PhabricatorRemarkupControl.php index 11388d257e..eeec4971da 100644 --- a/src/view/form/control/PhabricatorRemarkupControl.php +++ b/src/view/form/control/PhabricatorRemarkupControl.php @@ -45,7 +45,11 @@ final class PhabricatorRemarkupControl extends AphrontFormTextAreaControl { $root_id = celerity_generate_unique_node_id(); $user_datasource = new PhabricatorPeopleDatasource(); - $proj_datasource = new PhabricatorProjectDatasource(); + $proj_datasource = id(new PhabricatorProjectDatasource()) + ->setParameters( + array( + 'autocomplete' => 1, + )); Javelin::initBehavior( 'phabricator-remarkup-assist',