Make stored custom fields work with v3 EditEngine API
Summary: Ref T11114. This makes the unusual stored custom fields ("Blame Rev", "Revert Plan", etc) work somewhat correctly (?) with EditEngine.
Test Plan:
- Created, updated and edited revisions with unusual stored custom fields like "Blame Rev".
- Observed that these fields now populate in "differential.revision.edit" when available.
Reviewers: chad
Reviewed By: chad
Maniphest Tasks: T11114
Differential Revision: https://secure.phabricator.com/D17068
This commit is contained in:
@@ -57,4 +57,12 @@ final class DifferentialAuditorsField
|
||||
return $this->renderObjectList($handles);
|
||||
}
|
||||
|
||||
public function shouldAppearInConduitTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitPHIDListParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,4 +114,12 @@ final class DifferentialBlameRevisionField
|
||||
return true;
|
||||
}
|
||||
|
||||
public function shouldAppearInConduitTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ abstract class DifferentialCustomField
|
||||
return $this->getFieldKey();
|
||||
}
|
||||
|
||||
// TODO: As above.
|
||||
public function getModernFieldKey() {
|
||||
return $this->getFieldKeyForConduit();
|
||||
}
|
||||
|
||||
public function shouldEnableForRole($role) {
|
||||
switch ($role) {
|
||||
case self::ROLE_COMMITMESSAGE:
|
||||
|
||||
@@ -295,8 +295,6 @@ final class DifferentialJIRAIssuesField
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function renderCommitMessageValue(array $handles) {
|
||||
$value = $this->getValue();
|
||||
if (!$value) {
|
||||
@@ -309,5 +307,12 @@ final class DifferentialJIRAIssuesField
|
||||
return true;
|
||||
}
|
||||
|
||||
public function shouldAppearInConduitTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitStringListParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -142,4 +142,12 @@ final class DifferentialRevertPlanField
|
||||
return true;
|
||||
}
|
||||
|
||||
public function shouldAppearInConduitTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function newConduitEditParameterType() {
|
||||
return new ConduitStringParameterType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,8 +61,12 @@ abstract class DifferentialCommitMessageCustomField
|
||||
}
|
||||
|
||||
public function getFieldTransactions($value) {
|
||||
// TODO: Implement this!
|
||||
return array();
|
||||
return array(
|
||||
array(
|
||||
'type' => $this->getCommitMessageFieldKey(),
|
||||
'value' => $value,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -107,6 +107,13 @@ abstract class PhabricatorEditType extends Phobject {
|
||||
|
||||
public function getConduitType() {
|
||||
$parameter_type = $this->getConduitParameterType();
|
||||
if (!$parameter_type) {
|
||||
throw new Exception(
|
||||
pht(
|
||||
'Edit type (with key "%s") is missing a Conduit parameter type.',
|
||||
$this->getEditType()));
|
||||
}
|
||||
|
||||
return $parameter_type->getTypeName();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user