Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3797438
D129.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D129.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D129: Get Phabricator projects for paste events
Attached
Detach File
Event Timeline
Log In to Comment