From 9d0cf3c8b82d550de7f6b44801b29796d688c493 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 9 Mar 2018 12:16:10 -0800 Subject: [PATCH] Before anyone notices, break the API Summary: See PHI439. Use slightly richer "dominion" return values for consistency. Test Plan: Fetched results with `owners.search` API method. Differential Revision: https://secure.phabricator.com/D19208 --- .../storage/PhabricatorOwnersPackage.php | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php index eb17a3890e..56dd51a3c6 100644 --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -609,8 +609,8 @@ final class PhabricatorOwnersPackage ->setDescription(pht('Auto audit information.')), id(new PhabricatorConduitSearchFieldSpecification()) ->setKey('dominion') - ->setType('string') - ->setDescription(pht('Dominion setting.')), + ->setType('map') + ->setDescription(pht('Dominion setting information.')), ); } @@ -648,6 +648,22 @@ final class PhabricatorOwnersPackage 'label' => $audit_label, ); + $dominion_value = $this->getDominion(); + $dominion_map = self::getDominionOptionsMap(); + if (isset($dominion_map[$dominion_value])) { + $dominion_label = $dominion_map[$dominion_value]['name']; + $dominion_short = $dominion_map[$dominion_value]['short']; + } else { + $dominion_label = pht('Unknown ("%s")', $dominion_value); + $dominion_short = pht('Unknown ("%s")', $dominion_value); + } + + $dominion = array( + 'value' => $dominion_value, + 'label' => $dominion_label, + 'short' => $dominion_short, + ); + return array( 'name' => $this->getName(), 'description' => $this->getDescription(), @@ -655,7 +671,7 @@ final class PhabricatorOwnersPackage 'owners' => $owner_list, 'review' => $review, 'audit' => $audit, - 'dominion' => $this->getDominion(), + 'dominion' => $dominion, ); }