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

Specialize list<string> in config

Summary: Specialize editing, display and validation of list<string> options.

Test Plan: Edited, viewed and validated "environment.append-paths".

Reviewers: codeblock, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2255

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

+38 -2
+10 -1
src/applications/config/controller/PhabricatorConfigEditController.php
··· 226 226 case 'string': 227 227 $set_value = (string)$value; 228 228 break; 229 + case 'list<string>': 230 + $set_value = $request->getStrList('value'); 231 + break; 229 232 case 'bool': 230 233 switch ($value) { 231 234 case 'true': ··· 281 284 return $value; 282 285 case 'bool': 283 286 return $value ? 'true' : 'false'; 287 + case 'list<string>': 288 + return implode("\n", nonempty($value, array())); 284 289 default: 285 290 return $this->prettyPrintJSON($value); 286 291 } ··· 306 311 'false' => idx($option->getOptions(), 1), 307 312 )); 308 313 break; 314 + case 'list<string>': 315 + $control = id(new AphrontFormTextAreaControl()) 316 + ->setCaption(pht('Separate values with newlines or commas.')); 317 + break; 309 318 default: 310 319 $control = id(new AphrontFormTextAreaControl()) 311 320 ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) ··· 340 349 if ($value === null) { 341 350 $value = '<em>'.pht('(empty)').'</em>'; 342 351 } else { 343 - $value = phutil_escape_html($value); 352 + $value = nl2br(phutil_escape_html($value)); 344 353 } 345 354 346 355 $table[] = '<tr>';
+26
src/applications/config/option/PhabricatorApplicationConfigOptions.php
··· 41 41 $option->getKey())); 42 42 } 43 43 break; 44 + case 'list<string>': 45 + $valid = true; 46 + if (!is_array($value)) { 47 + throw new PhabricatorConfigValidationException( 48 + pht( 49 + "Option '%s' must be a list of strings, but value is not a ". 50 + "an array.", 51 + $option->getKey())); 52 + } 53 + if ($value && array_keys($value) != range(0, count($value) - 1)) { 54 + throw new PhabricatorConfigValidationException( 55 + pht( 56 + "Option '%s' must be a list of strings, but the value is a ". 57 + "map with unnatural keys.", 58 + $option->getKey())); 59 + } 60 + foreach ($value as $v) { 61 + if (!is_string($v)) { 62 + throw new PhabricatorConfigValidationException( 63 + pht( 64 + "Option '%s' must be a list of strings, but it contains one ". 65 + "or more non-strings.", 66 + $option->getKey())); 67 + } 68 + } 69 + break; 44 70 case 'wild': 45 71 default: 46 72 break;
+2 -1
src/applications/config/option/PhabricatorCoreConfigOptions.php
··· 90 90 "'nobody'). Here you can add extra directories to the \$PATH ". 91 91 "environment variable, for when these binaries are in ". 92 92 "non-standard locations.")) 93 - ->addExample('/usr/local/bin', 'Valid Setting'), 93 + ->addExample('/usr/local/bin', pht('Add One Path')) 94 + ->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')), 94 95 ); 95 96 } 96 97