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

Remove all hardcoded behaviors associated with task priorities

Summary:
Ref T3583. Currently, we have some hard-coded behaviors associated with the "Unbreak Now" and "Needs Triage" priorities. Remove them:

- Users seem somewhat confused by these on occasion, and never seem to think they're cool/useful (that I've seen, at least).
- I think they have low utility in general, see T3583.
- Saves three queries on the home page, which can no longer use row counting since they must be policy filtered.
- Primarily, this paves the way for allowing installs to customize priorities, which is an occasional request.

Also deletes a lot of code with no callsites.

Test Plan: Mostly `grep`. Loaded home page. Viewed reports and task list.

Reviewers: btrahan

Reviewed By: btrahan

CC: chad, aran

Maniphest Tasks: T3583

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

+12 -159
+6 -6
src/__celerity_resource_map__.php
··· 2926 2926 ), 2927 2927 'maniphest-transaction-detail-css' => 2928 2928 array( 2929 - 'uri' => '/res/30242771/rsrc/css/application/maniphest/transaction-detail.css', 2929 + 'uri' => '/res/f2c9582c/rsrc/css/application/maniphest/transaction-detail.css', 2930 2930 'type' => 'css', 2931 2931 'requires' => 2932 2932 array( ··· 4380 4380 'uri' => '/res/pkg/f32597c9/javelin.pkg.js', 4381 4381 'type' => 'js', 4382 4382 ), 4383 - '0a9e494f' => 4383 + 'ad2ed1da' => 4384 4384 array( 4385 4385 'name' => 'maniphest.pkg.css', 4386 4386 'symbols' => ··· 4389 4389 1 => 'maniphest-transaction-detail-css', 4390 4390 2 => 'phabricator-project-tag-css', 4391 4391 ), 4392 - 'uri' => '/res/pkg/0a9e494f/maniphest.pkg.css', 4392 + 'uri' => '/res/pkg/ad2ed1da/maniphest.pkg.css', 4393 4393 'type' => 'css', 4394 4394 ), 4395 4395 '83a3853e' => ··· 4505 4505 'javelin-vector' => 'f32597c9', 4506 4506 'javelin-workflow' => 'f32597c9', 4507 4507 'lightbox-attachment-css' => '1200d176', 4508 - 'maniphest-task-summary-css' => '0a9e494f', 4509 - 'maniphest-transaction-detail-css' => '0a9e494f', 4508 + 'maniphest-task-summary-css' => 'ad2ed1da', 4509 + 'maniphest-transaction-detail-css' => 'ad2ed1da', 4510 4510 'phabricator-action-list-view-css' => '1200d176', 4511 4511 'phabricator-application-launch-view-css' => '1200d176', 4512 4512 'phabricator-busy' => '8977e356', ··· 4532 4532 'phabricator-object-selector-css' => '44bfe40c', 4533 4533 'phabricator-phtize' => '8977e356', 4534 4534 'phabricator-prefab' => '8977e356', 4535 - 'phabricator-project-tag-css' => '0a9e494f', 4535 + 'phabricator-project-tag-css' => 'ad2ed1da', 4536 4536 'phabricator-property-list-view-css' => '1200d176', 4537 4537 'phabricator-remarkup-css' => '1200d176', 4538 4538 'phabricator-shaped-request' => '5e9e5c4e',
-88
src/applications/directory/controller/PhabricatorDirectoryMainController.php
··· 32 32 33 33 $maniphest = 'PhabricatorApplicationManiphest'; 34 34 if (PhabricatorApplication::isClassInstalled($maniphest)) { 35 - $unbreak_panel = $this->buildUnbreakNowPanel(); 36 - $triage_panel = $this->buildNeedsTriagePanel($projects); 37 35 $tasks_panel = $this->buildTasksPanel(); 38 36 } else { 39 - $unbreak_panel = null; 40 - $triage_panel = null; 41 37 $tasks_panel = null; 42 38 } 43 39 ··· 54 50 $content = array( 55 51 $jump_panel, 56 52 $welcome_panel, 57 - $unbreak_panel, 58 - $triage_panel, 59 53 $revision_panel, 60 54 $tasks_panel, 61 55 $audit_panel, ··· 94 88 } else { 95 89 return id(new AphrontRedirectResponse())->setURI('/'); 96 90 } 97 - } 98 - 99 - private function buildUnbreakNowPanel() { 100 - $user = $this->getRequest()->getUser(); 101 - 102 - $task_query = id(new ManiphestTaskQuery()) 103 - ->setViewer($user) 104 - ->withStatus(ManiphestTaskQuery::STATUS_OPEN) 105 - ->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW) 106 - ->setLimit(10); 107 - 108 - $tasks = $task_query->execute(); 109 - 110 - if (!$tasks) { 111 - return $this->renderMiniPanel( 112 - 'No "Unbreak Now!" Tasks', 113 - 'Nothing appears to be critically broken right now.'); 114 - } 115 - 116 - $panel = new AphrontPanelView(); 117 - $panel->setHeader('Unbreak Now!'); 118 - $panel->setCaption('Open tasks with "Unbreak Now!" priority.'); 119 - $panel->addButton( 120 - phutil_tag( 121 - 'a', 122 - array( 123 - 'href' => '/maniphest/view/all/', 124 - 'class' => 'grey button', 125 - ), 126 - "View All Unbreak Now \xC2\xBB")); 127 - 128 - $panel->appendChild($this->buildTaskListView($tasks)); 129 - $panel->setNoBackground(); 130 - 131 - return $panel; 132 - } 133 - 134 - private function buildNeedsTriagePanel(array $projects) { 135 - assert_instances_of($projects, 'PhabricatorProject'); 136 - 137 - $user = $this->getRequest()->getUser(); 138 - 139 - if ($projects) { 140 - $task_query = id(new ManiphestTaskQuery()) 141 - ->setViewer($user) 142 - ->withStatus(ManiphestTaskQuery::STATUS_OPEN) 143 - ->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE) 144 - ->withAnyProjects(mpull($projects, 'getPHID')) 145 - ->setLimit(10); 146 - $tasks = $task_query->execute(); 147 - } else { 148 - $tasks = array(); 149 - } 150 - 151 - if (!$tasks) { 152 - return $this->renderMiniPanel( 153 - 'No "Needs Triage" Tasks', 154 - hsprintf( 155 - 'No tasks in <a href="/project/">projects you are a member of</a> '. 156 - 'need triage.')); 157 - } 158 - 159 - $panel = new AphrontPanelView(); 160 - $panel->setHeader('Needs Triage'); 161 - $panel->setCaption(hsprintf( 162 - 'Open tasks with "Needs Triage" priority in '. 163 - '<a href="/project/">projects you are a member of</a>.')); 164 - 165 - $panel->addButton( 166 - phutil_tag( 167 - 'a', 168 - array( 169 - // TODO: This should filter to just your projects' need-triage 170 - // tasks? 171 - 'href' => '/maniphest/view/projecttriage/', 172 - 'class' => 'grey button', 173 - ), 174 - "View All Triage \xC2\xBB")); 175 - $panel->appendChild($this->buildTaskListView($tasks)); 176 - $panel->setNoBackground(); 177 - 178 - return $panel; 179 91 } 180 92 181 93 private function buildRevisionPanel() {
+3 -21
src/applications/maniphest/application/PhabricatorApplicationManiphest.php
··· 85 85 $query = id(new ManiphestTaskQuery()) 86 86 ->setViewer($user) 87 87 ->withStatus(ManiphestTaskQuery::STATUS_OPEN) 88 - ->withPriority(ManiphestTaskPriority::PRIORITY_UNBREAK_NOW) 89 - ->setLimit(1) 90 - ->setCalculateRows(true); 91 - $query->execute(); 92 - 93 - $count = $query->getRowCount(); 94 - $type = PhabricatorApplicationStatusView::TYPE_NEEDS_ATTENTION; 95 - $status[] = id(new PhabricatorApplicationStatusView()) 96 - ->setType($type) 97 - ->setText(pht('%d Unbreak Now Task(s)!', $count)) 98 - ->setCount($count); 99 - 100 - $query = id(new ManiphestTaskQuery()) 101 - ->setViewer($user) 102 - ->withStatus(ManiphestTaskQuery::STATUS_OPEN) 103 - ->withOwners(array($user->getPHID())) 104 - ->setLimit(1) 105 - ->setCalculateRows(true); 106 - $query->execute(); 88 + ->withOwners(array($user->getPHID())); 89 + $count = count($query->execute()); 107 90 108 - $count = $query->getRowCount(); 109 91 $type = PhabricatorApplicationStatusView::TYPE_WARNING; 110 92 $status[] = id(new PhabricatorApplicationStatusView()) 111 93 ->setType($type) 112 - ->setText(pht('%d Assigned Task(s)', $count)) 94 + ->setText(pht('%s Assigned Task(s)', new PhutilNumber($count))) 113 95 ->setCount($count); 114 96 115 97 return $status;
+1 -35
src/applications/maniphest/constants/ManiphestTaskPriority.php
··· 45 45 } 46 46 47 47 /** 48 - * Get the priorities and some bits for bitwise fun. 49 - * 50 - * @return map Priorities to bits. 51 - */ 52 - public static function getLoadMap() { 53 - return array( 54 - self::PRIORITY_UNBREAK_NOW => 16, 55 - self::PRIORITY_TRIAGE => 8, 56 - self::PRIORITY_HIGH => 4, 57 - self::PRIORITY_NORMAL => 2, 58 - self::PRIORITY_LOW => 1, 59 - self::PRIORITY_WISH => 0, 60 - ); 61 - } 62 - 63 - /** 64 - * Get the lowest defined priority. 65 - * 66 - * @return int The value of the lowest priority constant. 67 - */ 68 - public static function getLowestPriority() { 69 - return self::PRIORITY_WISH; 70 - } 71 - 72 - /** 73 - * Get the highest defined priority. 74 - * 75 - * @return int The value of the highest priority constant. 76 - */ 77 - public static function getHighestPriority() { 78 - return self::PRIORITY_UNBREAK_NOW; 79 - } 80 - /** 81 48 * Return the default priority for this instance of Phabricator. 82 49 * 83 50 * @return int The value of the default priority constant. 84 51 */ 85 52 public static function getDefaultPriority() { 86 - return PhabricatorEnv::getEnvConfig( 87 - 'maniphest.default-priority'); 53 + return PhabricatorEnv::getEnvConfig('maniphest.default-priority'); 88 54 } 89 55 90 56 /**
+1 -1
src/applications/maniphest/mail/ManiphestCreateMailReceiver.php
··· 64 64 65 65 $task->setAuthorPHID($sender->getPHID()); 66 66 $task->setOriginalEmailSource($mail->getHeader('From')); 67 - $task->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE); 67 + $task->setPriority(ManiphestTaskPriority::getDefaultPriority()); 68 68 69 69 $editor = new ManiphestTransactionEditor(); 70 70 $editor->setActor($sender);
+1 -4
src/applications/maniphest/view/ManiphestTransactionDetailView.php
··· 455 455 $old_name = ManiphestTaskPriority::getTaskPriorityName($old); 456 456 $new_name = ManiphestTaskPriority::getTaskPriorityName($new); 457 457 458 - if ($old == ManiphestTaskPriority::PRIORITY_TRIAGE) { 458 + if ($old == ManiphestTaskPriority::getDefaultPriority()) { 459 459 $verb = 'Triaged'; 460 460 $desc = 'triaged this task as "'.$new_name.'" priority'; 461 461 } else if ($old > $new) { ··· 466 466 $verb = 'Raised Priority'; 467 467 $desc = 'raised the priority of this task from "'.$old_name.'" to '. 468 468 '"'.$new_name.'"'; 469 - } 470 - if ($new == ManiphestTaskPriority::PRIORITY_UNBREAK_NOW) { 471 - $classes[] = 'unbreaknow'; 472 469 } 473 470 break; 474 471 case ManiphestTransactionType::TYPE_ATTACH:
-4
webroot/rsrc/css/application/maniphest/transaction-detail.css
··· 47 47 border-color: #660099; 48 48 } 49 49 50 - .phabricator-transaction-view .unbreaknow { 51 - border-color: #aa0000; 52 - } 53 - 54 50 .phabricator-transaction-view .duplicate { 55 51 border-color: #333333; 56 52 }