1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Do not hardcode default Priority names in Project Reports tooltip

Summary:
Pull the names of Priority field values instead of hardcoding them.

Closes T15799

Test Plan:
* As an admin, go to `/config/edit/maniphest.priorities/` and change the value of `"name"` of a Priority value with a value < `50` (e.g.: Low, Wishlist)
* Open `/maniphest/report/project/`
* Hover over the `Oldest (Pri)` column and check the tooltip text before and after applying this patch

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15799

Differential Revision: https://we.phorge.it/D25602
This commit is contained in:
Andre Klapper 2024-04-26 12:32:46 +02:00
parent d5295da072
commit e6925c83c1

View file

@ -487,6 +487,12 @@ final class ManiphestReportController extends ManiphestController {
);
}
private function getAveragePriority() {
// TODO: This is sort of a hard-code for the default "normal" status.
// When reports are more powerful, this should be made more general.
return 50;
}
public function renderOpenTasks() {
$request = $this->getRequest();
$viewer = $request->getUser();
@ -626,9 +632,7 @@ final class ManiphestReportController extends ManiphestController {
$normal_or_better = array();
foreach ($taskv as $id => $task) {
// TODO: This is sort of a hard-code for the default "normal" status.
// When reports are more powerful, this should be made more general.
if ($task->getPriority() < 50) {
if ($task->getPriority() < $this->getAveragePriority()) {
continue;
}
$normal_or_better[$id] = $task;
@ -700,13 +704,22 @@ final class ManiphestReportController extends ManiphestController {
),
pht('Oldest (All)'));
$cclass[] = 'n';
$low_priorities = array();
$priorities_map = ManiphestTaskPriority::getTaskPriorityMap();
$normal_priority = $this->getAveragePriority();
foreach ($priorities_map as $pri => $full_label) {
if ($pri < $normal_priority) {
$low_priorities[] = $full_label;
}
}
$pri_string = implode(', ', $low_priorities);
$cname[] = javelin_tag(
'span',
array(
'sigil' => 'has-tooltip',
'meta' => array(
'tip' => pht(
'Oldest open task, excluding those with Low or Wishlist priority.'),
'Oldest open task, excluding those with priority %s', $pri_string),
'size' => 200,
),
),