1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +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:
epriestley 2016-12-16 09:57:10 -08:00
parent f1f24e0360
commit 60f41b87e9
5 changed files with 22 additions and 75 deletions

View file

@ -7,10 +7,6 @@ final class DifferentialManiphestTasksField
return 'differential:maniphest-tasks';
}
public function getFieldKeyForConduit() {
return 'maniphestTaskPHIDs';
}
public function canDisableField() {
return false;
}
@ -41,25 +37,6 @@ final class DifferentialManiphestTasksField
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() {
return $this->getValue();
}
@ -68,44 +45,4 @@ final class DifferentialManiphestTasksField
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'),
);
}
}

View file

@ -57,13 +57,4 @@ final class DifferentialProjectReviewersField
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'),
);
}
}

View file

@ -192,6 +192,21 @@ final class DifferentialRevisionEditEngine
->setConduitTypeDescription(pht('New repository.'))
->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;
}

View file

@ -182,7 +182,7 @@ abstract class DifferentialCommitMessageField
protected function isCustomFieldEnabled($key) {
$field_list = PhabricatorCustomField::getObjectFields(
new DifferentialRevision(),
DifferentialCustomField::ROLE_COMMITMESSAGE);
DifferentialCustomField::ROLE_DEFAULT);
$fields = $field_list->getFields();
return isset($fields[$key]);

View file

@ -55,7 +55,11 @@ final class DifferentialTasksCommitMessageField
}
public function getFieldTransactions($value) {
// TODO: Implement this!
return array();
return array(
array(
'type' => 'tasks.set',
'value' => $value,
),
);
}
}