From 046c1b5b828d2ead3ffc5de26ab5abae43d3ae8c Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 7 Sep 2018 09:42:16 -0700 Subject: [PATCH] Expose "isDraft" and "holdAsDraft" revision properties over Conduit Summary: Ref T13195. See PHI861. The "+ Draft" flag is not currently exposed over the API, but seems stable enough to expose. Also expose the "hold as draft" flag, normally `arc diff --draft`. Today, you can get "+ Draft" with some other state by: - abandoning a draft revision ("Abandoned + Draft"); or - using `arc diff --plan-changes` with an older `arc` version ("Changes Planned + Draft"). Test Plan: Called `differential.revision.search` via Conduit and got sensible-looking results for revisions in various states. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13195 Differential Revision: https://secure.phabricator.com/D19648 --- .../storage/DifferentialRevision.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php index a432c02a96..9b169f3c67 100644 --- a/src/applications/differential/storage/DifferentialRevision.php +++ b/src/applications/differential/storage/DifferentialRevision.php @@ -1152,6 +1152,20 @@ final class DifferentialRevision extends DifferentialDAO ->setKey('testPlan') ->setType('string') ->setDescription(pht('Revision test plan.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('isDraft') + ->setType('bool') + ->setDescription( + pht( + 'True if this revision is in any draft state, and thus not '. + 'notifying reviewers and subscribers about changes.')), + id(new PhabricatorConduitSearchFieldSpecification()) + ->setKey('holdAsDraft') + ->setType('bool') + ->setDescription( + pht( + 'True if this revision is being held as a draft. It will not be '. + 'automatically submitted for review even if tests pass.')), ); } @@ -1172,6 +1186,8 @@ final class DifferentialRevision extends DifferentialDAO 'diffPHID' => $this->getActiveDiffPHID(), 'summary' => $this->getSummary(), 'testPlan' => $this->getTestPlan(), + 'isDraft' => !$this->getShouldBroadcast(), + 'holdAsDraft' => (bool)$this->getHoldAsDraft(), ); }