2014-02-26 23:46:18 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialManiphestTasksField
|
2014-03-08 19:51:01 +01:00
|
|
|
extends DifferentialCoreCustomField {
|
2014-02-26 23:46:18 +01:00
|
|
|
|
|
|
|
public function getFieldKey() {
|
|
|
|
return 'differential:maniphest-tasks';
|
|
|
|
}
|
|
|
|
|
2014-03-08 02:05:00 +01:00
|
|
|
public function getFieldKeyForConduit() {
|
|
|
|
return 'maniphestTaskPHIDs';
|
|
|
|
}
|
|
|
|
|
2014-03-08 18:13:51 +01:00
|
|
|
public function canDisableField() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-03-08 19:51:01 +01:00
|
|
|
public function shouldAppearInEditView() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
public function getFieldName() {
|
|
|
|
return pht('Maniphest Tasks');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldDescription() {
|
|
|
|
return pht('Lists associated tasks.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldAppearInPropertyView() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderPropertyViewLabel() {
|
|
|
|
return $this->getFieldName();
|
|
|
|
}
|
|
|
|
|
2014-03-08 19:51:01 +01:00
|
|
|
public function readValueFromRevision(DifferentialRevision $revision) {
|
|
|
|
if (!$revision->getPHID()) {
|
2014-03-08 02:05:00 +01:00
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
return PhabricatorEdgeQuery::loadDestinationPHIDs(
|
2014-03-08 19:51:01 +01:00
|
|
|
$revision->getPHID(),
|
2014-07-18 00:41:08 +02:00
|
|
|
DifferentialRevisionHasTaskEdgeType::EDGECONST);
|
2014-02-26 23:46:18 +01:00
|
|
|
}
|
|
|
|
|
2014-03-08 19:51:01 +01:00
|
|
|
public function getApplicationTransactionType() {
|
|
|
|
return PhabricatorTransactions::TYPE_EDGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionMetadata() {
|
|
|
|
return array(
|
2014-07-18 00:41:08 +02:00
|
|
|
'edge:type' => DifferentialRevisionHasTaskEdgeType::EDGECONST,
|
2014-03-08 19:51:01 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getNewValueForApplicationTransactions() {
|
|
|
|
$edges = array();
|
|
|
|
foreach ($this->getValue() as $phid) {
|
|
|
|
$edges[$phid] = $phid;
|
|
|
|
}
|
|
|
|
|
|
|
|
return array('=' => $edges);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDsForPropertyView() {
|
|
|
|
return $this->getValue();
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
public function renderPropertyViewValue(array $handles) {
|
|
|
|
return $this->renderHandleList($handles);
|
|
|
|
}
|
|
|
|
|
2014-03-08 02:05:00 +01:00
|
|
|
public function shouldAppearInCommitMessage() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldAllowEditInCommitMessage() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommitMessageLabels() {
|
|
|
|
return array(
|
|
|
|
'Maniphest Task',
|
|
|
|
'Maniphest Tasks',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function parseValueFromCommitMessage($value) {
|
|
|
|
return $this->parseObjectList(
|
|
|
|
$value,
|
|
|
|
array(
|
2014-07-24 00:05:46 +02:00
|
|
|
ManiphestTaskPHIDType::TYPECONST,
|
2014-03-08 02:05:00 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDsForCommitMessage() {
|
|
|
|
return $this->getRequiredHandlePHIDsForPropertyView();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderCommitMessageValue(array $handles) {
|
|
|
|
return $this->renderObjectList($handles);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getProTips() {
|
|
|
|
return array(
|
|
|
|
pht(
|
|
|
|
'Write "Fixes T123" in your summary to automatically close the '.
|
|
|
|
'corresponding task when this change lands.'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
}
|