Differential D17088 Diff 41104 src/applications/differential/customfield/DifferentialManiphestTasksField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/customfield/DifferentialManiphestTasksField.php
| <?php | <?php | ||||
| final class DifferentialManiphestTasksField | final class DifferentialManiphestTasksField | ||||
| extends DifferentialCoreCustomField { | extends DifferentialCoreCustomField { | ||||
| public function getFieldKey() { | public function getFieldKey() { | ||||
| return 'differential:maniphest-tasks'; | return 'differential:maniphest-tasks'; | ||||
| } | } | ||||
| public function getFieldKeyForConduit() { | |||||
| return 'maniphestTaskPHIDs'; | |||||
| } | |||||
| public function canDisableField() { | public function canDisableField() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| public function getFieldName() { | public function getFieldName() { | ||||
| return pht('Maniphest Tasks'); | return pht('Maniphest Tasks'); | ||||
| } | } | ||||
| Show All 14 Lines | if (!$revision->getPHID()) { | ||||
| return array(); | return array(); | ||||
| } | } | ||||
| return PhabricatorEdgeQuery::loadDestinationPHIDs( | return PhabricatorEdgeQuery::loadDestinationPHIDs( | ||||
| $revision->getPHID(), | $revision->getPHID(), | ||||
| DifferentialRevisionHasTaskEdgeType::EDGECONST); | DifferentialRevisionHasTaskEdgeType::EDGECONST); | ||||
| } | } | ||||
| public function getApplicationTransactionType() { | |||||
| return PhabricatorTransactions::TYPE_EDGE; | |||||
| } | |||||
| public function getApplicationTransactionMetadata() { | |||||
| return array( | |||||
| 'edge:type' => DifferentialRevisionHasTaskEdgeType::EDGECONST, | |||||
| ); | |||||
| } | |||||
| public function getNewValueForApplicationTransactions() { | |||||
| $edges = array(); | |||||
| foreach ($this->getValue() as $phid) { | |||||
| $edges[$phid] = $phid; | |||||
| } | |||||
| return array('=' => $edges); | |||||
| } | |||||
| public function getRequiredHandlePHIDsForPropertyView() { | public function getRequiredHandlePHIDsForPropertyView() { | ||||
| return $this->getValue(); | return $this->getValue(); | ||||
| } | } | ||||
| public function renderPropertyViewValue(array $handles) { | public function renderPropertyViewValue(array $handles) { | ||||
| return $this->renderHandleList($handles); | return $this->renderHandleList($handles); | ||||
| } | } | ||||
| 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( | |||||
| ManiphestTaskPHIDType::TYPECONST, | |||||
| )); | |||||
| } | |||||
| public function getRequiredHandlePHIDsForCommitMessage() { | |||||
| return $this->getRequiredHandlePHIDsForPropertyView(); | |||||
| } | |||||
| public function renderCommitMessageValue(array $handles) { | |||||
| return $this->renderObjectList($handles); | |||||
| } | |||||
| public function getProTips() { | |||||
| return array( | |||||
| pht( | |||||
| 'Write "%s" in your summary to automatically close the '. | |||||
| 'corresponding task when this change lands.', | |||||
| 'Fixes T123'), | |||||
| ); | |||||
| } | |||||
| } | } | ||||