mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-18 17:58:37 +01:00
Simplify "Tasks" field in Differential
Summary: Ref T11114. Keep UI, throw everything else away. Includes an imperfect-but-not-too-awful fix to keep the field actually working. Test Plan: Edited tasks from CLI. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17088
This commit is contained in:
parent
f1f24e0360
commit
60f41b87e9
5 changed files with 22 additions and 75 deletions
|
@ -7,10 +7,6 @@ final class DifferentialManiphestTasksField
|
||||||
return 'differential:maniphest-tasks';
|
return 'differential:maniphest-tasks';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFieldKeyForConduit() {
|
|
||||||
return 'maniphestTaskPHIDs';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function canDisableField() {
|
public function canDisableField() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,25 +37,6 @@ final class DifferentialManiphestTasksField
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
@ -68,44 +45,4 @@ final class DifferentialManiphestTasksField
|
||||||
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'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,13 +57,4 @@ final class DifferentialProjectReviewersField
|
||||||
return $reviewers;
|
return $reviewers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProTips() {
|
|
||||||
return array(
|
|
||||||
pht(
|
|
||||||
'You can add a project as a subscriber or reviewer by writing '.
|
|
||||||
'"%s" in the appropriate field.',
|
|
||||||
'#projectname'),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,21 @@ final class DifferentialRevisionEditEngine
|
||||||
->setConduitTypeDescription(pht('New repository.'))
|
->setConduitTypeDescription(pht('New repository.'))
|
||||||
->setSingleValue($object->getRepositoryPHID());
|
->setSingleValue($object->getRepositoryPHID());
|
||||||
|
|
||||||
|
// This is a little flimsy, but allows "Maniphest Tasks: ..." to continue
|
||||||
|
// working properly in commit messages until we fully sort out T5873.
|
||||||
|
$fields[] = id(new PhabricatorHandlesEditField())
|
||||||
|
->setKey('tasks')
|
||||||
|
->setUseEdgeTransactions(true)
|
||||||
|
->setIsConduitOnly(true)
|
||||||
|
->setTransactionType(PhabricatorTransactions::TYPE_EDGE)
|
||||||
|
->setMetadataValue(
|
||||||
|
'edge:type',
|
||||||
|
DifferentialRevisionHasTaskEdgeType::EDGECONST)
|
||||||
|
->setDescription(pht('Tasks associated with this revision.'))
|
||||||
|
->setConduitDescription(pht('Change associated tasks.'))
|
||||||
|
->setConduitTypeDescription(pht('List of tasks.'))
|
||||||
|
->setValue(array());
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,7 +182,7 @@ abstract class DifferentialCommitMessageField
|
||||||
protected function isCustomFieldEnabled($key) {
|
protected function isCustomFieldEnabled($key) {
|
||||||
$field_list = PhabricatorCustomField::getObjectFields(
|
$field_list = PhabricatorCustomField::getObjectFields(
|
||||||
new DifferentialRevision(),
|
new DifferentialRevision(),
|
||||||
DifferentialCustomField::ROLE_COMMITMESSAGE);
|
DifferentialCustomField::ROLE_DEFAULT);
|
||||||
|
|
||||||
$fields = $field_list->getFields();
|
$fields = $field_list->getFields();
|
||||||
return isset($fields[$key]);
|
return isset($fields[$key]);
|
||||||
|
|
|
@ -55,7 +55,11 @@ final class DifferentialTasksCommitMessageField
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getFieldTransactions($value) {
|
public function getFieldTransactions($value) {
|
||||||
// TODO: Implement this!
|
return array(
|
||||||
return array();
|
array(
|
||||||
|
'type' => 'tasks.set',
|
||||||
|
'value' => $value,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue