Page MenuHomeDevCentral

D129.id.diff
No OneTemporary

D129.id.diff

diff --git a/app/Phabricator/PhabricatorStory.php b/app/Phabricator/PhabricatorStory.php
--- a/app/Phabricator/PhabricatorStory.php
+++ b/app/Phabricator/PhabricatorStory.php
@@ -141,6 +141,12 @@
);
break;
+ case 'PSTE':
+ return $this->getItemProjectsPHIDsThroughApplicationSearch(
+ 'paste.search',
+ $objectPHID
+ );
+
default:
return [];
}
@@ -186,6 +192,30 @@
}
/**
+ * Gets the project for a specific item, using the new ApplicationSearch.
+ *
+ * This is a transitional method: when every Phabricator will have been
+ * migrated from info (generation 1) or query (generation 2) to search
+ * (generation 3), we'll rename it to getItemProjectsPHIDs and overwrite it.
+ */
+ protected function getItemProjectsPHIDsThroughApplicationSearch ($method, $objectPHID) {
+ if (!$objectPHID) {
+ return [];
+ }
+
+ $api = PhabricatorAPI::forInstance($this->instance);
+ $reply = $api->call(
+ $method,
+ [
+ 'constraints[phids][0]' => $objectPHID,
+ 'attachments[projects]' => 1
+ ]
+ );
+
+ return PhabricatorAPI::getFirstResult($reply)->attachments->projects->projectPHIDs;
+ }
+
+ /**
* Gets the list of the projects associated to the story
*
* @return string[] The list of project PHIDs

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 11:24 (9 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2271147
Default Alt Text
D129.id.diff (1 KB)

Event Timeline