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

Permit users to touch `maniphest.points`

Summary: Ref T4427. Seems fine / not egregiously broken.

Test Plan: Edited points configuration. Tried to set a bad value. Set a good value. Persued examples and help text.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4427

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

+70 -3
+2
src/__phutil_library_map__.php
··· 1300 1300 'ManiphestHovercardEngineExtension' => 'applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php', 1301 1301 'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php', 1302 1302 'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php', 1303 + 'ManiphestPointsConfigOptionType' => 'applications/maniphest/config/ManiphestPointsConfigOptionType.php', 1303 1304 'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php', 1304 1305 'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php', 1305 1306 'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php', ··· 5460 5461 'ManiphestHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 5461 5462 'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod', 5462 5463 'ManiphestNameIndex' => 'ManiphestDAO', 5464 + 'ManiphestPointsConfigOptionType' => 'PhabricatorConfigJSONOptionType', 5463 5465 'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType', 5464 5466 'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand', 5465 5467 'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
+10
src/applications/maniphest/config/ManiphestPointsConfigOptionType.php
··· 1 + <?php 2 + 3 + final class ManiphestPointsConfigOptionType 4 + extends PhabricatorConfigJSONOptionType { 5 + 6 + public function validateOption(PhabricatorConfigOption $option, $value) { 7 + ManiphestTaskPoints::validateConfiguration($value); 8 + } 9 + 10 + }
+41 -3
src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
··· 255 255 ); 256 256 $fields_json = id(new PhutilJSON())->encodeFormatted($fields_example); 257 257 258 + $points_type = 'custom:ManiphestPointsConfigOptionType'; 259 + 260 + $points_example_1 = array( 261 + 'enabled' => true, 262 + 'label' => pht('Story Points'), 263 + 'action' => pht('Change Story Points'), 264 + ); 265 + $points_json_1 = id(new PhutilJSON())->encodeFormatted($points_example_1); 266 + 267 + $points_example_2 = array( 268 + 'enabled' => true, 269 + 'label' => pht('Estimated Hours'), 270 + 'action' => pht('Change Estimate'), 271 + ); 272 + $points_json_2 = id(new PhutilJSON())->encodeFormatted($points_example_2); 273 + 274 + $points_description = $this->deformat(pht(<<<EOTEXT 275 + Activates a points field on tasks. You can use points for estimation or 276 + planning. If configured, points will appear on workboards. 277 + 278 + To activate points, set this value to a map with these keys: 279 + 280 + - `enabled` //Optional bool.// Use `true` to enable points, or 281 + `false` to disable them. 282 + - `label` //Optional string.// Label for points, like "Story Points" or 283 + "Estimated Hours". If omitted, points will be called "Points". 284 + - `action` //Optional string.// Label for the action which changes points 285 + in Maniphest, like "Change Estimate". If omitted, the action will 286 + be called "Change Points". 287 + 288 + See the example below for a starting point. 289 + EOTEXT 290 + )); 291 + 292 + 293 + 258 294 return array( 259 295 $this->newOption('maniphest.custom-field-definitions', 'wild', array()) 260 296 ->setSummary(pht('Custom Maniphest fields.')) ··· 336 372 '"Needs Triage" panel on the home page. You should adjust this if '. 337 373 'you adjust priorities using `%s`.', 338 374 'maniphest.priorities')), 339 - $this->newOption('maniphest.points', 'map<string, wild>', array()) 340 - ->setDescription( 341 - pht('PROTOTYPE! Very hot. Burns user. Do not touch!')), 375 + $this->newOption('maniphest.points', $points_type, array()) 376 + ->setSummary(pht('Configure point values for tasks.')) 377 + ->setDescription($points_description) 378 + ->addExample($points_json_1, pht('Points Config')) 379 + ->addExample($points_json_2, pht('Hours Config')), 342 380 ); 343 381 } 344 382
+17
src/applications/maniphest/constants/ManiphestTaskPoints.php
··· 21 21 return PhabricatorEnv::getEnvConfig('maniphest.points'); 22 22 } 23 23 24 + public static function validateConfiguration($config) { 25 + if (!is_array($config)) { 26 + throw new Exception( 27 + pht( 28 + 'Configuration is not valid. Maniphest points configuration must '. 29 + 'be a dictionary.')); 30 + } 31 + 32 + PhutilTypeSpec::checkMap( 33 + $config, 34 + array( 35 + 'enabled' => 'optional bool', 36 + 'label' => 'optional string', 37 + 'action' => 'optional string', 38 + )); 39 + } 40 + 24 41 }