mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
83c0fda280
Summary: Ref T8726. The only notable bit here is that the "body" / "title" fields (which are currently shared across a bunch of types) are getting split into application variants. Among other things, this will let us label the field "Commit message" for commits, for example. Test Plan: - Created a rule using all four fields. - Applied patch, saw rule break ("unknown field"). - Ran storage upgrade, saw rule fix itself in the migration. - Edited tasks, triggered rule, viewed transcripts. Reviewers: btrahan Reviewed By: btrahan Subscribers: eadler, joshuaspence, epriestley Maniphest Tasks: T8726 Differential Revision: https://secure.phabricator.com/D13501
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class ManiphestTaskPriorityHeraldField
|
|
extends ManiphestTaskHeraldField {
|
|
|
|
const FIELDCONST = 'taskpriority';
|
|
|
|
public function getHeraldFieldName() {
|
|
return pht('Priority');
|
|
}
|
|
|
|
public function getHeraldFieldValue($object) {
|
|
return $object->getPriority();
|
|
}
|
|
|
|
protected function getHeraldFieldStandardConditions() {
|
|
return self::STANDARD_PHID;
|
|
}
|
|
|
|
public function getHeraldFieldValueType($condition) {
|
|
return HeraldAdapter::VALUE_TASK_PRIORITY;
|
|
}
|
|
|
|
public function renderConditionValue(
|
|
PhabricatorUser $viewer,
|
|
$value) {
|
|
|
|
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
|
|
|
|
$value = (array)$value;
|
|
foreach ($value as $index => $val) {
|
|
$name = idx($priority_map, $val);
|
|
if ($name !== null) {
|
|
$value[$index] = $name;
|
|
}
|
|
}
|
|
|
|
return implode(', ', $value);
|
|
}
|
|
|
|
public function getEditorValue(
|
|
PhabricatorUser $viewer,
|
|
$value) {
|
|
|
|
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
|
|
|
|
$value_map = array();
|
|
foreach ($value as $priority) {
|
|
$value_map[$priority] = idx($priority_map, $priority, $priority);
|
|
}
|
|
|
|
return $value_map;
|
|
}
|
|
|
|
}
|