From 471e89a8b76db5c0b0234cddbcba26a43b413eeb Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 13 Apr 2020 14:14:32 -0700 Subject: [PATCH] Add "uri" to "paste.search" API output Summary: Ref T13490. This simplifies some client behavior in the general case. Test Plan: Called API method, saw URIs. Maniphest Tasks: T13490 Differential Revision: https://secure.phabricator.com/D21105 --- .../differential/storage/DifferentialRevision.php | 4 ++++ src/applications/paste/storage/PhabricatorPaste.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index 960b405060..23825e0cb3 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -1052,6 +1052,10 @@ final class DifferentialRevision extends DifferentialDAO ->setKey('title') ->setType('string') ->setDescription(pht('The revision title.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('uri') + ->setType('uri') + ->setDescription(pht('View URI for the revision.')), id(new PhabricatorConduitSearchFieldSpecification()) ->setKey('authorPHID') ->setType('phid') diff --git a/src/applications/paste/storage/PhabricatorPaste.php b/src/applications/paste/storage/PhabricatorPaste.php index 79f1a953f6..971ec63f86 100644 --- a/src/applications/paste/storage/PhabricatorPaste.php +++ b/src/applications/paste/storage/PhabricatorPaste.php @@ -241,6 +241,10 @@ final class PhabricatorPaste extends PhabricatorPasteDAO ->setKey('title') ->setType('string') ->setDescription(pht('The title of the paste.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('uri') + ->setType('uri') + ->setDescription(pht('View URI for the paste.')), id(new PhabricatorConduitSearchFieldSpecification()) ->setKey('authorPHID') ->setType('phid') @@ -259,6 +263,7 @@ final class PhabricatorPaste extends PhabricatorPasteDAO public function getFieldValuesForConduit() { return array( 'title' => $this->getTitle(), + 'uri' => PhabricatorEnv::getURI($this->getURI()), 'authorPHID' => $this->getAuthorPHID(), 'language' => nonempty($this->getLanguage(), null), 'status' => $this->getStatus(),