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

Make Maniphest task priorites user-customizable

Summary: Drive these purely out of configuration after removing behavioral hardcodes in D6981.

Test Plan:
Mucked around with them:

{F58128} {F58129} {F58130}

Reviewers: btrahan

Reviewed By: btrahan

CC: chad, aran

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

+97 -42
+1 -1
src/__celerity_resource_map__.php
··· 963 963 ), 964 964 'config-options-css' => 965 965 array( 966 - 'uri' => '/res/cbef6aae/rsrc/css/application/config/config-options.css', 966 + 'uri' => '/res/4b5b6779/rsrc/css/application/config/config-options.css', 967 967 'type' => 'css', 968 968 'requires' => 969 969 array(
+52
src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
··· 12 12 } 13 13 14 14 public function getOptions() { 15 + 16 + $priority_defaults = array( 17 + 100 => array( 18 + 'name' => pht('Unbreak Now!'), 19 + 'short' => pht('Unbreak!'), 20 + 'color' => 'indigo', 21 + ), 22 + 90 => array( 23 + 'name' => pht('Needs Triage'), 24 + 'short' => pht('Triage'), 25 + 'color' => 'violet', 26 + ), 27 + 80 => array( 28 + 'name' => pht('High'), 29 + 'short' => pht('High'), 30 + 'color' => 'red', 31 + ), 32 + 50 => array( 33 + 'name' => pht('Normal'), 34 + 'short' => pht('Normal'), 35 + 'color' => 'orange', 36 + ), 37 + 25 => array( 38 + 'name' => pht('Low'), 39 + 'short' => pht('Low'), 40 + 'color' => 'yellow', 41 + ), 42 + 0 => array( 43 + 'name' => pht('Wishlist'), 44 + 'short' => pht('Wish'), 45 + 'color' => 'sky', 46 + ), 47 + ); 48 + 15 49 return array( 16 50 $this->newOption('maniphest.custom-fields', 'wild', array()) 17 51 ->setSummary(pht("Custom Maniphest fields.")) ··· 36 70 "Class which drives custom field construction. See 'Maniphest ". 37 71 "User Guide: Adding Custom Fields' in the documentation for more ". 38 72 "information.")), 73 + $this->newOption('maniphest.priorities', 'wild', $priority_defaults) 74 + ->setSummary(pht("Configure Maniphest priority names.")) 75 + ->setDescription( 76 + pht( 77 + 'Allows you to edit or override the default priorities available '. 78 + 'in Maniphest, like "High", "Normal" and "Low". The configuration '. 79 + 'should contain a map of priority constants to priority '. 80 + 'specifications (see defaults below for examples).'. 81 + "\n\n". 82 + 'The keys you can define for a priority are:'. 83 + "\n\n". 84 + ' - `name` Name of the priority.'."\n". 85 + ' - `short` Alternate shorter name, used in UIs where there is '. 86 + ' not much space available.'."\n". 87 + ' - `color` A color for this priority, like "red" or "blue".'. 88 + "\n\n". 89 + 'You can choose which priority is the default for newly created '. 90 + 'tasks with `maniphest.default-priority`.')), 39 91 $this->newOption('maniphest.default-priority', 'int', 90) 40 92 ->setSummary(pht("Default task priority for create flows.")) 41 93 ->setDescription(
+38 -31
src/applications/maniphest/constants/ManiphestTaskPriority.php
··· 1 1 <?php 2 2 3 - /** 4 - * @group maniphest 5 - */ 6 3 final class ManiphestTaskPriority extends ManiphestConstants { 7 4 8 - const PRIORITY_UNBREAK_NOW = 100; 9 - const PRIORITY_TRIAGE = 90; 10 - const PRIORITY_HIGH = 80; 11 - const PRIORITY_NORMAL = 50; 12 - const PRIORITY_LOW = 25; 13 - const PRIORITY_WISH = 0; 14 - 15 5 /** 16 6 * Get the priorities and their full descriptions. 17 7 * 18 8 * @return map Priorities to descriptions. 19 9 */ 20 10 public static function getTaskPriorityMap() { 21 - return array( 22 - self::PRIORITY_UNBREAK_NOW => 'Unbreak Now!', 23 - self::PRIORITY_TRIAGE => 'Needs Triage', 24 - self::PRIORITY_HIGH => 'High', 25 - self::PRIORITY_NORMAL => 'Normal', 26 - self::PRIORITY_LOW => 'Low', 27 - self::PRIORITY_WISH => 'Wishlist', 28 - ); 11 + $map = self::getConfig(); 12 + foreach ($map as $key => $spec) { 13 + $map[$key] = idx($spec, 'name', $key); 14 + } 15 + return $map; 29 16 } 30 17 18 + 31 19 /** 32 20 * Get the priorities and their related short (one-word) descriptions. 33 21 * 34 - * @return map Priorities to brief descriptions. 22 + * @return map Priorities to short descriptions. 23 + */ 24 + public static function getShortNameMap() { 25 + $map = self::getConfig(); 26 + foreach ($map as $key => $spec) { 27 + $map[$key] = idx($spec, 'short', idx($spec, 'name', $key)); 28 + } 29 + return $map; 30 + } 31 + 32 + 33 + /** 34 + * Get a map from priority constants to their colors. 35 + * 36 + * @return map<int, string> Priorities to colors. 35 37 */ 36 - public static function getTaskBriefPriorityMap() { 37 - return array( 38 - self::PRIORITY_UNBREAK_NOW => 'Unbreak!', 39 - self::PRIORITY_TRIAGE => 'Triage', 40 - self::PRIORITY_HIGH => 'High', 41 - self::PRIORITY_NORMAL => 'Normal', 42 - self::PRIORITY_LOW => 'Low', 43 - self::PRIORITY_WISH => 'Wish', 44 - ); 38 + public static function getColorMap() { 39 + $map = self::getConfig(); 40 + foreach ($map as $key => $spec) { 41 + $map[$key] = idx($spec, 'color', 'grey'); 42 + } 43 + return $map; 45 44 } 45 + 46 46 47 47 /** 48 48 * Return the default priority for this instance of Phabricator. ··· 52 52 public static function getDefaultPriority() { 53 53 return PhabricatorEnv::getEnvConfig('maniphest.default-priority'); 54 54 } 55 + 55 56 56 57 /** 57 58 * Retrieve the full name of the priority level provided. 58 59 * 59 60 * @param int A priority level. 60 - * @return string The priority name if the level is a valid one, 61 - * or `???` if it is not. 61 + * @return string The priority name if the level is a valid one. 62 62 */ 63 63 public static function getTaskPriorityName($priority) { 64 - return idx(self::getTaskPriorityMap(), $priority, '???'); 64 + return idx(self::getTaskPriorityMap(), $priority, $priority); 65 + } 66 + 67 + 68 + private static function getConfig() { 69 + $config = PhabricatorEnv::getEnvConfig('maniphest.priorities'); 70 + krsort($config); 71 + return $config; 65 72 } 66 73 67 74 }
+4 -2
src/applications/maniphest/controller/ManiphestReportController.php
··· 520 520 521 521 $normal_or_better = array(); 522 522 foreach ($taskv as $id => $task) { 523 - if ($task->getPriority() < ManiphestTaskPriority::PRIORITY_NORMAL) { 523 + // TODO: This is sort of a hard-code for the default "normal" status. 524 + // When reports are more powerful, this should be made more general. 525 + if ($task->getPriority() < 50) { 524 526 continue; 525 527 } 526 528 $normal_or_better[$id] = $task; ··· 574 576 575 577 $cname = array($col_header); 576 578 $cclass = array('pri right wide'); 577 - $pri_map = ManiphestTaskPriority::getTaskBriefPriorityMap(); 579 + $pri_map = ManiphestTaskPriority::getShortNameMap(); 578 580 foreach ($pri_map as $pri => $label) { 579 581 $cname[] = $label; 580 582 $cclass[] = 'n';
+1 -8
src/applications/maniphest/view/ManiphestTaskListView.php
··· 40 40 $list->setFlush(true); 41 41 42 42 $status_map = ManiphestTaskStatus::getTaskStatusMap(); 43 - $color_map = array( 44 - ManiphestTaskPriority::PRIORITY_UNBREAK_NOW => 'indigo', 45 - ManiphestTaskPriority::PRIORITY_TRIAGE => 'violet', 46 - ManiphestTaskPriority::PRIORITY_HIGH => 'red', 47 - ManiphestTaskPriority::PRIORITY_NORMAL => 'orange', 48 - ManiphestTaskPriority::PRIORITY_LOW => 'yellow', 49 - ManiphestTaskPriority::PRIORITY_WISH => 'sky', 50 - ); 43 + $color_map = ManiphestTaskPriority::getColorMap(); 51 44 52 45 if ($this->showBatchControls) { 53 46 Javelin::initBehavior('maniphest-list-editor');
+1
webroot/rsrc/css/application/config/config-options.css
··· 31 31 .config-option-table td { 32 32 color: {$darkgreytext}; 33 33 width: 100%; 34 + white-space: pre-wrap; 34 35 } 35 36 36 37 .config-option-table .column-labels th {