Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15390634
D15256.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D15256.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1300,6 +1300,7 @@
'ManiphestHovercardEngineExtension' => 'applications/maniphest/engineextension/ManiphestHovercardEngineExtension.php',
'ManiphestInfoConduitAPIMethod' => 'applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php',
'ManiphestNameIndex' => 'applications/maniphest/storage/ManiphestNameIndex.php',
+ 'ManiphestPointsConfigOptionType' => 'applications/maniphest/config/ManiphestPointsConfigOptionType.php',
'ManiphestPriorityConfigOptionType' => 'applications/maniphest/config/ManiphestPriorityConfigOptionType.php',
'ManiphestPriorityEmailCommand' => 'applications/maniphest/command/ManiphestPriorityEmailCommand.php',
'ManiphestProjectNameFulltextEngineExtension' => 'applications/maniphest/engineextension/ManiphestProjectNameFulltextEngineExtension.php',
@@ -5460,6 +5461,7 @@
'ManiphestHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'ManiphestInfoConduitAPIMethod' => 'ManiphestConduitAPIMethod',
'ManiphestNameIndex' => 'ManiphestDAO',
+ 'ManiphestPointsConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'ManiphestPriorityConfigOptionType' => 'PhabricatorConfigJSONOptionType',
'ManiphestPriorityEmailCommand' => 'ManiphestEmailCommand',
'ManiphestProjectNameFulltextEngineExtension' => 'PhabricatorFulltextEngineExtension',
diff --git a/src/applications/maniphest/config/ManiphestPointsConfigOptionType.php b/src/applications/maniphest/config/ManiphestPointsConfigOptionType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/config/ManiphestPointsConfigOptionType.php
@@ -0,0 +1,10 @@
+<?php
+
+final class ManiphestPointsConfigOptionType
+ extends PhabricatorConfigJSONOptionType {
+
+ public function validateOption(PhabricatorConfigOption $option, $value) {
+ ManiphestTaskPoints::validateConfiguration($value);
+ }
+
+}
diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
--- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
+++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
@@ -255,6 +255,42 @@
);
$fields_json = id(new PhutilJSON())->encodeFormatted($fields_example);
+ $points_type = 'custom:ManiphestPointsConfigOptionType';
+
+ $points_example_1 = array(
+ 'enabled' => true,
+ 'label' => pht('Story Points'),
+ 'action' => pht('Change Story Points'),
+ );
+ $points_json_1 = id(new PhutilJSON())->encodeFormatted($points_example_1);
+
+ $points_example_2 = array(
+ 'enabled' => true,
+ 'label' => pht('Estimated Hours'),
+ 'action' => pht('Change Estimate'),
+ );
+ $points_json_2 = id(new PhutilJSON())->encodeFormatted($points_example_2);
+
+ $points_description = $this->deformat(pht(<<<EOTEXT
+Activates a points field on tasks. You can use points for estimation or
+planning. If configured, points will appear on workboards.
+
+To activate points, set this value to a map with these keys:
+
+ - `enabled` //Optional bool.// Use `true` to enable points, or
+ `false` to disable them.
+ - `label` //Optional string.// Label for points, like "Story Points" or
+ "Estimated Hours". If omitted, points will be called "Points".
+ - `action` //Optional string.// Label for the action which changes points
+ in Maniphest, like "Change Estimate". If omitted, the action will
+ be called "Change Points".
+
+See the example below for a starting point.
+EOTEXT
+));
+
+
+
return array(
$this->newOption('maniphest.custom-field-definitions', 'wild', array())
->setSummary(pht('Custom Maniphest fields.'))
@@ -336,9 +372,11 @@
'"Needs Triage" panel on the home page. You should adjust this if '.
'you adjust priorities using `%s`.',
'maniphest.priorities')),
- $this->newOption('maniphest.points', 'map<string, wild>', array())
- ->setDescription(
- pht('PROTOTYPE! Very hot. Burns user. Do not touch!')),
+ $this->newOption('maniphest.points', $points_type, array())
+ ->setSummary(pht('Configure point values for tasks.'))
+ ->setDescription($points_description)
+ ->addExample($points_json_1, pht('Points Config'))
+ ->addExample($points_json_2, pht('Hours Config')),
);
}
diff --git a/src/applications/maniphest/constants/ManiphestTaskPoints.php b/src/applications/maniphest/constants/ManiphestTaskPoints.php
--- a/src/applications/maniphest/constants/ManiphestTaskPoints.php
+++ b/src/applications/maniphest/constants/ManiphestTaskPoints.php
@@ -21,4 +21,21 @@
return PhabricatorEnv::getEnvConfig('maniphest.points');
}
+ public static function validateConfiguration($config) {
+ if (!is_array($config)) {
+ throw new Exception(
+ pht(
+ 'Configuration is not valid. Maniphest points configuration must '.
+ 'be a dictionary.'));
+ }
+
+ PhutilTypeSpec::checkMap(
+ $config,
+ array(
+ 'enabled' => 'optional bool',
+ 'label' => 'optional string',
+ 'action' => 'optional string',
+ ));
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 6:23 AM (6 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7390248
Default Alt Text
D15256.diff (5 KB)
Attached To
Mode
D15256: Permit users to touch `maniphest.points`
Attached
Detach File
Event Timeline
Log In to Comment