@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.

In Conduit, let checkbox constraints self-document

Summary:
Ref T13195. Ref PHI851. Currently, checkbox constraints don't tell you what values are supported on the API page.

You can figure this out with "Inspect Element" or by viewing the source code, but just render a nice table instead.

Test Plan: {F5862969}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13195

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

+86 -1
+2
src/__phutil_library_map__.php
··· 313 313 'ConduitCallTestCase' => 'applications/conduit/call/__tests__/ConduitCallTestCase.php', 314 314 'ConduitColumnsParameterType' => 'applications/conduit/parametertype/ConduitColumnsParameterType.php', 315 315 'ConduitConnectConduitAPIMethod' => 'applications/conduit/method/ConduitConnectConduitAPIMethod.php', 316 + 'ConduitConstantDescription' => 'applications/conduit/data/ConduitConstantDescription.php', 316 317 'ConduitEpochParameterType' => 'applications/conduit/parametertype/ConduitEpochParameterType.php', 317 318 'ConduitException' => 'applications/conduit/protocol/exception/ConduitException.php', 318 319 'ConduitGetCapabilitiesConduitAPIMethod' => 'applications/conduit/method/ConduitGetCapabilitiesConduitAPIMethod.php', ··· 5628 5629 'ConduitCallTestCase' => 'PhabricatorTestCase', 5629 5630 'ConduitColumnsParameterType' => 'ConduitParameterType', 5630 5631 'ConduitConnectConduitAPIMethod' => 'ConduitAPIMethod', 5632 + 'ConduitConstantDescription' => 'Phobject', 5631 5633 'ConduitEpochParameterType' => 'ConduitParameterType', 5632 5634 'ConduitException' => 'Exception', 5633 5635 'ConduitGetCapabilitiesConduitAPIMethod' => 'ConduitAPIMethod',
+26
src/applications/conduit/data/ConduitConstantDescription.php
··· 1 + <?php 2 + 3 + final class ConduitConstantDescription extends Phobject { 4 + 5 + private $key; 6 + private $value; 7 + 8 + public function setKey($key) { 9 + $this->key = $key; 10 + return $this; 11 + } 12 + 13 + public function getKey() { 14 + return $this->key; 15 + } 16 + 17 + public function setValue($value) { 18 + $this->value = $value; 19 + return $this; 20 + } 21 + 22 + public function getValue() { 23 + return $this->value; 24 + } 25 + 26 + }
+42 -1
src/applications/search/engine/PhabricatorSearchEngineAPIMethod.php
··· 190 190 $fields, 191 191 array('ids', 'phids')) + $fields; 192 192 193 + $constant_lists = array(); 194 + 193 195 $rows = array(); 194 196 foreach ($fields as $field) { 195 197 $key = $field->getConduitKey(); 196 198 $label = $field->getLabel(); 197 199 200 + $constants = $field->newConduitConstants(); 201 + 198 202 $type_object = $field->getConduitParameterType(); 199 203 if ($type_object) { 200 204 $type = $type_object->getTypeName(); 201 205 $description = $field->getDescription(); 206 + if ($constants) { 207 + $description = array( 208 + $description, 209 + ' ', 210 + phutil_tag('em', array(), pht('(See table below.)')), 211 + ); 212 + } 202 213 } else { 203 214 $type = null; 204 215 $description = phutil_tag('em', array(), pht('Not supported.')); ··· 210 221 $type, 211 222 $description, 212 223 ); 224 + 225 + if ($constants) { 226 + $constant_lists[] = $this->buildRemarkup( 227 + pht( 228 + 'Constants supported by the `%s` constraint:', 229 + 'statuses')); 230 + 231 + $constants_rows = array(); 232 + foreach ($constants as $constant) { 233 + $constants_rows[] = array( 234 + $constant->getKey(), 235 + $constant->getValue(), 236 + ); 237 + } 238 + 239 + $constants_table = id(new AphrontTableView($constants_rows)) 240 + ->setHeaders( 241 + array( 242 + pht('Key'), 243 + pht('Value'), 244 + )) 245 + ->setColumnClasses( 246 + array( 247 + 'pre', 248 + 'wide', 249 + )); 250 + 251 + $constant_lists[] = $constants_table; 252 + } 213 253 } 214 254 215 255 $table = id(new AphrontTableView($rows)) ··· 233 273 ->setCollapsed(true) 234 274 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 235 275 ->appendChild($this->buildRemarkup($info)) 236 - ->appendChild($table); 276 + ->appendChild($table) 277 + ->appendChild($constant_lists); 237 278 } 238 279 239 280 private function buildOrderBox(
+12
src/applications/search/field/PhabricatorSearchCheckboxesField.php
··· 49 49 return new ConduitStringListParameterType(); 50 50 } 51 51 52 + public function newConduitConstants() { 53 + $list = array(); 54 + 55 + foreach ($this->getOptions() as $key => $option) { 56 + $list[] = id(new ConduitConstantDescription()) 57 + ->setKey($key) 58 + ->setValue($option); 59 + } 60 + 61 + return $list; 62 + } 63 + 52 64 }
+4
src/applications/search/field/PhabricatorSearchField.php
··· 382 382 return $this->enableForConduit; 383 383 } 384 384 385 + public function newConduitConstants() { 386 + return array(); 387 + } 388 + 385 389 386 390 /* -( Utility Methods )----------------------------------------------------- */ 387 391