1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 12:00:55 +01:00

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:
epriestley 2016-12-16 06:08:06 -08:00
parent 64509dcca7
commit a74d602b3c
7 changed files with 49 additions and 4 deletions

View file

@ -57,4 +57,12 @@ final class DifferentialAuditorsField
return $this->renderObjectList($handles);
}
public function shouldAppearInConduitTransactions() {
return true;
}
protected function newConduitEditParameterType() {
return new ConduitPHIDListParameterType();
}
}

View file

@ -114,4 +114,12 @@ final class DifferentialBlameRevisionField
return true;
}
public function shouldAppearInConduitTransactions() {
return true;
}
protected function newConduitEditParameterType() {
return new ConduitStringParameterType();
}
}

View file

@ -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:

View file

@ -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();
}
}

View file

@ -142,4 +142,12 @@ final class DifferentialRevertPlanField
return true;
}
public function shouldAppearInConduitTransactions() {
return true;
}
protected function newConduitEditParameterType() {
return new ConduitStringParameterType();
}
}

View file

@ -61,8 +61,12 @@ abstract class DifferentialCommitMessageCustomField
}
public function getFieldTransactions($value) {
// TODO: Implement this!
return array();
return array(
array(
'type' => $this->getCommitMessageFieldKey(),
'value' => $value,
),
);
}
}

View file

@ -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();
}