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

Merge pull request #172 from floatingLomas/arcpatch-D3109

Arcpatch d3109

+118 -12
+21 -6
src/applications/maniphest/ManiphestTaskQuery.php
··· 48 48 49 49 private $priority = null; 50 50 51 + private $minPriority = null; 52 + private $maxPriority = null; 53 + 51 54 private $groupBy = 'group-none'; 52 55 const GROUP_NONE = 'group-none'; 53 56 const GROUP_PRIORITY = 'group-priority'; ··· 117 120 118 121 public function withPriority($priority) { 119 122 $this->priority = $priority; 123 + return $this; 124 + } 125 + 126 + public function withPrioritiesBetween($min, $max) { 127 + $this->minPriority = $min; 128 + $this->maxPriority = $max; 120 129 return $this; 121 130 } 122 131 ··· 317 326 } 318 327 319 328 private function buildPriorityWhereClause($conn) { 320 - if ($this->priority === null) { 321 - return null; 329 + if ($this->priority !== null) { 330 + return qsprintf( 331 + $conn, 332 + 'priority = %d', 333 + $this->priority); 334 + } elseif ($this->minPriority !== null && $this->maxPriority !== null) { 335 + return qsprintf( 336 + $conn, 337 + 'priority >= %d AND priority <= %d', 338 + $this->minPriority, 339 + $this->maxPriority); 322 340 } 323 341 324 - return qsprintf( 325 - $conn, 326 - 'priority = %d', 327 - $this->priority); 342 + return null; 328 343 } 329 344 330 345 private function buildAuthorWhereClause($conn) {
+40 -1
src/applications/maniphest/constants/ManiphestTaskPriority.php
··· 28 28 const PRIORITY_LOW = 25; 29 29 const PRIORITY_WISH = 0; 30 30 31 + /** 32 + * Get the priorities and their full descriptions. 33 + * 34 + * @return map Priorities to descriptions. 35 + */ 31 36 public static function getTaskPriorityMap() { 32 37 return array( 33 38 self::PRIORITY_UNBREAK_NOW => 'Unbreak Now!', ··· 39 44 ); 40 45 } 41 46 47 + /** 48 + * Get the priorities and their related short (one-word) descriptions. 49 + * 50 + * @return map Priorities to brief descriptions. 51 + */ 42 52 public static function getTaskBriefPriorityMap() { 43 53 return array( 44 54 self::PRIORITY_UNBREAK_NOW => 'Unbreak!', ··· 50 60 ); 51 61 } 52 62 53 - 63 + /** 64 + * Get the priorities and some bits for bitwise fun. 65 + * 66 + * @return map Priorities to bits. 67 + */ 54 68 public static function getLoadMap() { 55 69 return array( 56 70 self::PRIORITY_UNBREAK_NOW => 16, ··· 62 76 ); 63 77 } 64 78 79 + /** 80 + * Get the lowest defined priority. 81 + * 82 + * @return int The value of the lowest priority constant. 83 + */ 84 + public static function getLowestPriority() { 85 + return self::PRIORITY_WISH; 86 + } 87 + 88 + /** 89 + * Get the highest defined priority. 90 + * 91 + * @return int The value of the highest priority constant. 92 + */ 93 + public static function getHighestPriority() { 94 + return self::PRIORITY_UNBREAK_NOW; 95 + } 96 + 97 + /** 98 + * Retrieve the full name of the priority level provided. 99 + * 100 + * @param int A priority level. 101 + * @return string The priority name if the level is a valid one, 102 + * or `???` if it is not. 103 + */ 65 104 public static function getTaskPriorityName($priority) { 66 105 return idx(self::getTaskPriorityMap(), $priority, '???'); 67 106 }
+57 -5
src/applications/maniphest/controller/ManiphestTaskListController.php
··· 49 49 $search_text = $request->getStr('set_search'); 50 50 $search_text = nonempty($search_text, null); 51 51 52 + $min_priority = $request->getInt('set_lpriority'); 53 + $min_priority = nonempty($min_priority, null); 54 + 55 + $max_priority = $request->getInt('set_hpriority'); 56 + $max_priority = nonempty($max_priority, null); 57 + 52 58 $uri = $request->getRequestURI() 53 59 ->alter('users', $this->getArrToStrList('set_users')) 54 60 ->alter('projects', $this->getArrToStrList('set_projects')) 55 61 ->alter('xprojects', $this->getArrToStrList('set_xprojects')) 56 62 ->alter('owners', $this->getArrToStrList('set_owners')) 57 63 ->alter('authors', $this->getArrToStrList('set_authors')) 64 + ->alter('lpriority', $min_priority) 65 + ->alter('hpriority', $max_priority) 58 66 ->alter('tasks', $task_ids) 59 67 ->alter('search', $search_text); 60 68 ··· 113 121 $exclude_project_phids = $query->getParameter( 114 122 'excludeProjectPHIDs', 115 123 array()); 124 + $low_priority = $query->getParameter('lowPriority'); 125 + $high_priority = $query->getParameter('highPriority'); 126 + 116 127 $page_size = $query->getParameter('limit'); 117 128 $page = $query->getParameter('offset'); 118 129 ··· 209 220 ->setName('set_xprojects') 210 221 ->setLabel('Exclude Projects') 211 222 ->setValue($tokens)); 223 + 224 + $priority = ManiphestTaskPriority::getLowestPriority(); 225 + if ($low_priority) { 226 + $priority = $low_priority; 227 + } 228 + 229 + $form->appendChild( 230 + id(new AphrontFormSelectControl()) 231 + ->setLabel('Min Priority') 232 + ->setName('set_lpriority') 233 + ->setValue($priority) 234 + ->setOptions(array_reverse( 235 + ManiphestTaskPriority::getTaskPriorityMap(), true))); 236 + 237 + $priority = ManiphestTaskPriority::getHighestPriority(); 238 + if ($high_priority) { 239 + $priority = $high_priority; 240 + } 241 + 242 + $form->appendChild( 243 + id(new AphrontFormSelectControl()) 244 + ->setLabel('Max Priority') 245 + ->setName('set_hpriority') 246 + ->setValue($priority) 247 + ->setOptions(ManiphestTaskPriority::getTaskPriorityMap())); 248 + 212 249 } 213 250 214 251 $form ··· 377 414 $owner_phids = $search_query->getParameter('ownerPHIDs', array()); 378 415 $author_phids = $search_query->getParameter('authorPHIDs', array()); 379 416 417 + $low_priority = $search_query->getParameter('lowPriority'); 418 + $low_priority = nonempty($low_priority, 419 + ManiphestTaskPriority::getLowestPriority()); 420 + $high_priority = $search_query->getParameter('highPriority'); 421 + $high_priority = nonempty($high_priority, 422 + ManiphestTaskPriority::getHighestPriority()); 423 + 380 424 $query = new ManiphestTaskQuery(); 381 425 $query->withProjects($project_phids); 382 426 $query->withTaskIDs($task_ids); ··· 427 471 break; 428 472 case 'projectall': 429 473 $any_project = true; 474 + break; 475 + case 'custom': 476 + $query->withPrioritiesBetween($low_priority, $high_priority); 430 477 break; 431 478 } 432 479 ··· 640 687 } 641 688 642 689 private function buildQueryFromRequest() { 643 - $request = $this->getRequest(); 644 - $user = $request->getUser(); 690 + $request = $this->getRequest(); 691 + $user = $request->getUser(); 645 692 646 693 $status = $this->getStatusValueFromRequest(); 647 694 $group = $this->getGroupValueFromRequest(); ··· 682 729 $task_ids = $numeric_task_ids; 683 730 } 684 731 685 - $owner_phids = $request->getStrList('owners'); 686 - $author_phids = $request->getStrList('authors'); 732 + $owner_phids = $request->getStrList('owners'); 733 + $author_phids = $request->getStrList('authors'); 734 + 735 + $search_string = $request->getStr('search'); 687 736 688 - $search_string = $request->getStr('search'); 737 + $low_priority = $request->getInt('lpriority'); 738 + $high_priority = $request->getInt('hpriority'); 689 739 690 740 $page = $request->getInt('offset'); 691 741 $page_size = self::DEFAULT_PAGE_SIZE; ··· 702 752 'ownerPHIDs' => $owner_phids, 703 753 'authorPHIDs' => $author_phids, 704 754 'taskIDs' => $task_ids, 755 + 'lowPriority' => $low_priority, 756 + 'highPriority' => $high_priority, 705 757 'group' => $group, 706 758 'order' => $order, 707 759 'offset' => $page,