@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Flesh out Conduit parameter types for Owners + CustomFields

Summary:
Ref T9964. Fill in more parameter types and descriptions.

(No date support yet since it's a bit more involved.)

Test Plan: {F1024022}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9964

Differential Revision: https://secure.phabricator.com/D14766

+196 -7
+6
src/__phutil_library_map__.php
··· 223 223 'ConduitAPIRequest' => 'applications/conduit/protocol/ConduitAPIRequest.php', 224 224 'ConduitAPIResponse' => 'applications/conduit/protocol/ConduitAPIResponse.php', 225 225 'ConduitApplicationNotInstalledException' => 'applications/conduit/protocol/exception/ConduitApplicationNotInstalledException.php', 226 + 'ConduitBoolParameterType' => 'applications/conduit/parametertype/ConduitBoolParameterType.php', 226 227 'ConduitCall' => 'applications/conduit/call/ConduitCall.php', 227 228 'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php', 228 229 'ConduitConnectConduitAPIMethod' => 'applications/conduit/method/ConduitConnectConduitAPIMethod.php', ··· 232 233 'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php', 233 234 'ConduitGetCapabilitiesConduitAPIMethod' => 'applications/conduit/method/ConduitGetCapabilitiesConduitAPIMethod.php', 234 235 'ConduitGetCertificateConduitAPIMethod' => 'applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php', 236 + 'ConduitIntParameterType' => 'applications/conduit/parametertype/ConduitIntParameterType.php', 235 237 'ConduitListParameterType' => 'applications/conduit/parametertype/ConduitListParameterType.php', 236 238 'ConduitLogGarbageCollector' => 'applications/conduit/garbagecollector/ConduitLogGarbageCollector.php', 237 239 'ConduitMethodDoesNotExistException' => 'applications/conduit/protocol/exception/ConduitMethodDoesNotExistException.php', ··· 244 246 'ConduitResultSearchEngineExtension' => 'applications/conduit/query/ConduitResultSearchEngineExtension.php', 245 247 'ConduitSSHWorkflow' => 'applications/conduit/ssh/ConduitSSHWorkflow.php', 246 248 'ConduitStringListParameterType' => 'applications/conduit/parametertype/ConduitStringListParameterType.php', 249 + 'ConduitStringParameterType' => 'applications/conduit/parametertype/ConduitStringParameterType.php', 247 250 'ConduitTokenGarbageCollector' => 'applications/conduit/garbagecollector/ConduitTokenGarbageCollector.php', 248 251 'ConduitUserListParameterType' => 'applications/conduit/parametertype/ConduitUserListParameterType.php', 249 252 'ConpherenceColumnViewController' => 'applications/conpherence/controller/ConpherenceColumnViewController.php', ··· 4072 4075 'ConduitAPIRequest' => 'Phobject', 4073 4076 'ConduitAPIResponse' => 'Phobject', 4074 4077 'ConduitApplicationNotInstalledException' => 'ConduitMethodNotFoundException', 4078 + 'ConduitBoolParameterType' => 'ConduitListParameterType', 4075 4079 'ConduitCall' => 'Phobject', 4076 4080 'ConduitCallTestCase' => 'PhabricatorTestCase', 4077 4081 'ConduitConnectConduitAPIMethod' => 'ConduitAPIMethod', ··· 4081 4085 'ConduitException' => 'Exception', 4082 4086 'ConduitGetCapabilitiesConduitAPIMethod' => 'ConduitAPIMethod', 4083 4087 'ConduitGetCertificateConduitAPIMethod' => 'ConduitAPIMethod', 4088 + 'ConduitIntParameterType' => 'ConduitListParameterType', 4084 4089 'ConduitListParameterType' => 'ConduitParameterType', 4085 4090 'ConduitLogGarbageCollector' => 'PhabricatorGarbageCollector', 4086 4091 'ConduitMethodDoesNotExistException' => 'ConduitMethodNotFoundException', ··· 4093 4098 'ConduitResultSearchEngineExtension' => 'PhabricatorSearchEngineExtension', 4094 4099 'ConduitSSHWorkflow' => 'PhabricatorSSHWorkflow', 4095 4100 'ConduitStringListParameterType' => 'ConduitListParameterType', 4101 + 'ConduitStringParameterType' => 'ConduitListParameterType', 4096 4102 'ConduitTokenGarbageCollector' => 'PhabricatorGarbageCollector', 4097 4103 'ConduitUserListParameterType' => 'ConduitListParameterType', 4098 4104 'ConpherenceColumnViewController' => 'ConpherenceController',
+36
src/applications/conduit/parametertype/ConduitBoolParameterType.php
··· 1 + <?php 2 + 3 + final class ConduitBoolParameterType 4 + extends ConduitListParameterType { 5 + 6 + protected function getParameterValue(array $request, $key) { 7 + $value = parent::getParameterValue($request, $key); 8 + 9 + if (!is_bool($value)) { 10 + $this->raiseValidationException( 11 + $request, 12 + $key, 13 + pht('Expected boolean (true or false), got something else.')); 14 + } 15 + 16 + return $value; 17 + } 18 + 19 + protected function getParameterTypeName() { 20 + return 'bool'; 21 + } 22 + 23 + protected function getParameterFormatDescriptions() { 24 + return array( 25 + pht('A boolean.'), 26 + ); 27 + } 28 + 29 + protected function getParameterExamples() { 30 + return array( 31 + 'true', 32 + 'false', 33 + ); 34 + } 35 + 36 + }
+9 -4
src/applications/conduit/parametertype/ConduitEpochParameterType.php
··· 10 10 $this->raiseValidationException( 11 11 $request, 12 12 $key, 13 - pht('Expected integer, got something else.')); 13 + pht('Expected epoch timestamp as integer, got something else.')); 14 + } 15 + 16 + if ($value <= 0) { 17 + $this->raiseValidationException( 18 + $request, 19 + $key, 20 + pht('Epoch timestamp must be larger than 0, got %d.', $value)); 14 21 } 15 22 16 23 return $value; ··· 28 35 29 36 protected function getParameterExamples() { 30 37 return array( 31 - '["PHID-PROJ-1111"]', 32 - '["backend"]', 33 - '["PHID-PROJ-2222", "frontend"]', 38 + '1450019509', 34 39 ); 35 40 } 36 41
+37
src/applications/conduit/parametertype/ConduitIntParameterType.php
··· 1 + <?php 2 + 3 + final class ConduitIntParameterType 4 + extends ConduitListParameterType { 5 + 6 + protected function getParameterValue(array $request, $key) { 7 + $value = parent::getParameterValue($request, $key); 8 + 9 + if (!is_int($value)) { 10 + $this->raiseValidationException( 11 + $request, 12 + $key, 13 + pht('Expected integer, got something else.')); 14 + } 15 + 16 + return $value; 17 + } 18 + 19 + protected function getParameterTypeName() { 20 + return 'int'; 21 + } 22 + 23 + protected function getParameterFormatDescriptions() { 24 + return array( 25 + pht('An integer.'), 26 + ); 27 + } 28 + 29 + protected function getParameterExamples() { 30 + return array( 31 + '123', 32 + '0', 33 + '-345', 34 + ); 35 + } 36 + 37 + }
+35
src/applications/conduit/parametertype/ConduitStringParameterType.php
··· 1 + <?php 2 + 3 + final class ConduitStringParameterType 4 + extends ConduitListParameterType { 5 + 6 + protected function getParameterValue(array $request, $key) { 7 + $value = parent::getParameterValue($request, $key); 8 + 9 + if (!is_string($value)) { 10 + $this->raiseValidationException( 11 + $request, 12 + $key, 13 + pht('Expected string, got something else.')); 14 + } 15 + 16 + return $value; 17 + } 18 + 19 + protected function getParameterTypeName() { 20 + return 'string'; 21 + } 22 + 23 + protected function getParameterFormatDescriptions() { 24 + return array( 25 + pht('A string.'), 26 + ); 27 + } 28 + 29 + protected function getParameterExamples() { 30 + return array( 31 + '"papaya"', 32 + ); 33 + } 34 + 35 + }
+11 -1
src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php
··· 21 21 ->setLabel(pht('Authority')) 22 22 ->setKey('authorityPHIDs') 23 23 ->setAliases(array('authority', 'authorities')) 24 + ->setConduitKey('owners') 25 + ->setDescription( 26 + pht('Search for packages with specific owners.')) 24 27 ->setDatasource(new PhabricatorProjectOrUserDatasource()), 25 28 id(new PhabricatorSearchDatasourceField()) 26 29 ->setLabel(pht('Repositories')) 27 30 ->setKey('repositoryPHIDs') 31 + ->setConduitKey('repositories') 28 32 ->setAliases(array('repository', 'repositories')) 33 + ->setDescription( 34 + pht('Search for packages by included repositories.')) 29 35 ->setDatasource(new DiffusionRepositoryDatasource()), 30 36 id(new PhabricatorSearchStringListField()) 31 37 ->setLabel(pht('Paths')) 32 38 ->setKey('paths') 33 - ->setAliases(array('path')), 39 + ->setAliases(array('path')) 40 + ->setDescription( 41 + pht('Search for packages affecting specific paths.')), 34 42 id(new PhabricatorSearchCheckboxesField()) 35 43 ->setKey('statuses') 36 44 ->setLabel(pht('Status')) 45 + ->setDescription( 46 + pht('Search for active or archived packages.')) 37 47 ->setOptions( 38 48 id(new PhabricatorOwnersPackage()) 39 49 ->getStatusNameMap()),
+6 -2
src/applications/search/engine/PhabricatorSearchEngineAPIMethod.php
··· 196 196 ); 197 197 198 198 $head_builtin = pht('Builtin Order'); 199 - $head_description = pht('Description'); 199 + $head_label = pht('Label'); 200 200 $head_columns = pht('Columns'); 201 201 202 202 $orders = $query->getBuiltinOrders(); 203 203 204 204 $table = array(); 205 - $table[] = "| {$head_builtin} | {$head_description} | {$head_columns} |"; 205 + $table[] = "| {$head_builtin} | {$head_label} | {$head_columns} |"; 206 206 $table[] = '|-----------------|---------------------|-----------------|'; 207 207 foreach ($orders as $key => $order) { 208 208 $name = $order['name']; ··· 309 309 310 310 EOTEXT 311 311 ); 312 + 313 + $head_key = pht('Key'); 314 + $head_type = pht('Type'); 315 + $head_description = pht('Description'); 312 316 313 317 $specs = $engine->getAllConduitFieldSpecifications(); 314 318
+8
src/applications/search/field/PhabricatorSearchCustomFieldProxyField.php
··· 63 63 $this->getValue()); 64 64 } 65 65 66 + public function getDescription() { 67 + return $this->getCustomField()->getFieldDescription(); 68 + } 69 + 70 + protected function newConduitParameterType() { 71 + return $this->getCustomField()->getConduitSearchParameterType(); 72 + } 73 + 66 74 }
+4
src/applications/search/field/PhabricatorSearchDatasourceField.php
··· 14 14 return $this; 15 15 } 16 16 17 + protected function newConduitParameterType() { 18 + return new ConduitStringListParameterType(); 19 + } 20 + 17 21 }
+11
src/infrastructure/customfield/field/PhabricatorCustomField.php
··· 1337 1337 return false; 1338 1338 } 1339 1339 1340 + public function getConduitSearchParameterType() { 1341 + return $this->newConduitSearchParameterType(); 1342 + } 1343 + 1344 + protected function newConduitSearchParameterType() { 1345 + if ($this->proxy) { 1346 + return $this->proxy->newConduitSearchParameterType(); 1347 + } 1348 + return null; 1349 + } 1350 + 1340 1351 1341 1352 /* -( Herald )------------------------------------------------------------- */ 1342 1353
+1
src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
··· 463 463 return $this->getFieldValue(); 464 464 } 465 465 466 + 466 467 }
+3
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldBool.php
··· 133 133 return new AphrontBoolHTTPParameterType(); 134 134 } 135 135 136 + protected function newConduitSearchParameterType() { 137 + return new ConduitBoolParameterType(); 138 + } 136 139 }
+5
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php
··· 197 197 return false; 198 198 } 199 199 200 + protected function newConduitSearchParameterType() { 201 + // TODO: Build a new "pair<epoch|null, epoch|null>" type or similar. 202 + return null; 203 + } 204 + 200 205 }
+4
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldHeader.php
··· 30 30 return $this->getFieldName(); 31 31 } 32 32 33 + public function shouldAppearInApplicationSearch() { 34 + return false; 35 + } 36 + 33 37 }
+3
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php
··· 116 116 return new AphrontIntHTTPParameterType(); 117 117 } 118 118 119 + protected function newConduitSearchParameterType() { 120 + return new ConduitIntParameterType(); 121 + } 119 122 120 123 }
+3
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php
··· 84 84 return new AphrontStringHTTPParameterType(); 85 85 } 86 86 87 + protected function newConduitSearchParameterType() { 88 + return new ConduitStringListParameterType(); 89 + } 87 90 }
+3
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php
··· 99 99 return new AphrontStringHTTPParameterType(); 100 100 } 101 101 102 + public function shouldAppearInApplicationSearch() { 103 + return false; 104 + } 102 105 103 106 }
+3
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php
··· 140 140 return new AphrontSelectHTTPParameterType(); 141 141 } 142 142 143 + protected function newConduitSearchParameterType() { 144 + return new ConduitStringListParameterType(); 145 + } 143 146 }
+4
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php
··· 67 67 return new AphrontStringHTTPParameterType(); 68 68 } 69 69 70 + public function shouldAppearInApplicationSearch() { 71 + return false; 72 + } 73 + 70 74 }
+4
src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldUsers.php
··· 15 15 return new AphrontUserListHTTPParameterType(); 16 16 } 17 17 18 + protected function newConduitSearchParameterType() { 19 + return new ConduitUserListParameterType(); 20 + } 21 + 18 22 }