Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15376110
D17154.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D17154.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3514,6 +3514,7 @@
'PhabricatorProjectWatcherListView' => 'applications/project/view/PhabricatorProjectWatcherListView.php',
'PhabricatorProjectWorkboardBackgroundColor' => 'applications/project/constants/PhabricatorProjectWorkboardBackgroundColor.php',
'PhabricatorProjectWorkboardProfileMenuItem' => 'applications/project/menuitem/PhabricatorProjectWorkboardProfileMenuItem.php',
+ 'PhabricatorProjectsAncestorsSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsAncestorsSearchEngineAttachment.php',
'PhabricatorProjectsCurtainExtension' => 'applications/project/engineextension/PhabricatorProjectsCurtainExtension.php',
'PhabricatorProjectsEditEngineExtension' => 'applications/project/engineextension/PhabricatorProjectsEditEngineExtension.php',
'PhabricatorProjectsEditField' => 'applications/transactions/editfield/PhabricatorProjectsEditField.php',
@@ -8666,6 +8667,7 @@
'PhabricatorProjectWatcherListView' => 'PhabricatorProjectUserListView',
'PhabricatorProjectWorkboardBackgroundColor' => 'Phobject',
'PhabricatorProjectWorkboardProfileMenuItem' => 'PhabricatorProfileMenuItem',
+ 'PhabricatorProjectsAncestorsSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment',
'PhabricatorProjectsCurtainExtension' => 'PHUICurtainExtension',
'PhabricatorProjectsEditEngineExtension' => 'PhabricatorEditEngineExtension',
'PhabricatorProjectsEditField' => 'PhabricatorTokenizerEditField',
diff --git a/src/applications/project/engineextension/PhabricatorProjectsAncestorsSearchEngineAttachment.php b/src/applications/project/engineextension/PhabricatorProjectsAncestorsSearchEngineAttachment.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/engineextension/PhabricatorProjectsAncestorsSearchEngineAttachment.php
@@ -0,0 +1,30 @@
+<?php
+
+final class PhabricatorProjectsAncestorsSearchEngineAttachment
+ extends PhabricatorSearchEngineAttachment {
+
+ public function getAttachmentName() {
+ return pht('Project Ancestors');
+ }
+
+ public function getAttachmentDescription() {
+ return pht('Get the full ancestor list for each project.');
+ }
+
+ public function getAttachmentForObject($object, $data, $spec) {
+ $ancestors = $object->getAncestorProjects();
+
+ // Order ancestors by depth, ascending.
+ $ancestors = array_reverse($ancestors);
+
+ $results = array();
+ foreach ($ancestors as $ancestor) {
+ $results[] = $ancestor->getRefForConduit();
+ }
+
+ return array(
+ 'ancestors' => $results,
+ );
+ }
+
+}
diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php
--- a/src/applications/project/storage/PhabricatorProject.php
+++ b/src/applications/project/storage/PhabricatorProject.php
@@ -746,6 +746,20 @@
->setType('int?')
->setDescription(pht('For milestones, milestone sequence number.')),
id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('parent')
+ ->setType('map<string, wild>?')
+ ->setDescription(
+ pht(
+ 'For subprojects and milestones, a brief description of the '.
+ 'parent project.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
+ ->setKey('depth')
+ ->setType('int')
+ ->setDescription(
+ pht(
+ 'For subprojects and milestones, depth of this project in the '.
+ 'tree. Root projects have depth 0.')),
+ id(new PhabricatorConduitSearchFieldSpecification())
->setKey('icon')
->setType('map<string, wild>')
->setDescription(pht('Information about the project icon.')),
@@ -766,10 +780,19 @@
$milestone = null;
}
+ $parent = $this->getParentProject();
+ if ($parent) {
+ $parent_ref = $parent->getRefForConduit();
+ } else {
+ $parent_ref = null;
+ }
+
return array(
'name' => $this->getName(),
'slug' => $this->getPrimarySlug(),
'milestone' => $milestone,
+ 'depth' => (int)$this->getProjectDepth(),
+ 'parent' => $parent_ref,
'icon' => array(
'key' => $this->getDisplayIconKey(),
'name' => $this->getDisplayIconName(),
@@ -788,6 +811,20 @@
->setAttachmentKey('members'),
id(new PhabricatorProjectsWatchersSearchEngineAttachment())
->setAttachmentKey('watchers'),
+ id(new PhabricatorProjectsAncestorsSearchEngineAttachment())
+ ->setAttachmentKey('ancestors'),
+ );
+ }
+
+ /**
+ * Get an abbreviated representation of this project for use in providing
+ * "parent" and "ancestor" information.
+ */
+ public function getRefForConduit() {
+ return array(
+ 'id' => (int)$this->getID(),
+ 'phid' => $this->getPHID(),
+ 'name' => $this->getName(),
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 1:48 AM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384225
Default Alt Text
D17154.diff (4 KB)
Attached To
Mode
D17154: Add "parent" and "ancestor" information to the project.search API
Attached
Detach File
Event Timeline
Log In to Comment