Page MenuHomePhabricator

D15261.id36828.diff
No OneTemporary

D15261.id36828.diff

diff --git a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
--- a/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
+++ b/src/applications/project/editor/PhabricatorProjectTransactionEditor.php
@@ -169,11 +169,12 @@
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
--- a/src/applications/project/typeahead/PhabricatorProjectDatasource.php
+++ b/src/applications/project/typeahead/PhabricatorProjectDatasource.php
@@ -38,6 +38,8 @@
$query->withIsMilestone(false);
}
+ $for_autocomplete = $this->getParameter('autocomplete');
+
$projs = $this->executeQuery($query);
$projs = mpull($projs, null, 'getPHID');
@@ -58,6 +60,23 @@
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 @@
->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
--- a/src/view/form/control/PhabricatorRemarkupControl.php
+++ b/src/view/form/control/PhabricatorRemarkupControl.php
@@ -45,7 +45,11 @@
$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',

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 15, 4:42 PM (4 w, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712653
Default Alt Text
D15261.id36828.diff (2 KB)

Event Timeline