1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 11:22:40 +01:00
phorge-phorge/src/applications/differential/field/DifferentialSubscribersCommitMessageField.php
epriestley 64509dcca7 Drive CLI-based revision edits through "differential.revision.edit" API + EditEngine
Summary:
Ref T11114. This creates `differential.revision.edit` (a modern, v3 API method) and redefines the existing methods in terms of it.

Both `differential.createrevision` and `differential.updaterevision` are now internally implemented by building a `differential.revision.edit` API call and then executing it.

I //think// this covers everything except custom fields, which need some tweaking to work with EditEngine. I'll clean that up in the next change.

Test Plan:
  - Created, updated, and edited revisions via `arc`.
  - Called APIs manually via test console.
  - Stored custom fields ("Blame Rev", "Revert Plan") aren't exposed yet.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

Differential Revision: https://secure.phabricator.com/D17067
2016-12-16 10:08:49 -08:00

60 lines
1.3 KiB
PHP

<?php
final class DifferentialSubscribersCommitMessageField
extends DifferentialCommitMessageField {
const FIELDKEY = 'ccPHIDs';
public function getFieldName() {
return pht('Subscribers');
}
public function getFieldOrder() {
return 6000;
}
public function getFieldAliases() {
return array(
'CC',
'CCs',
'Subscriber',
);
}
public function parseFieldValue($value) {
return $this->parseObjectList(
$value,
array(
PhabricatorPeopleUserPHIDType::TYPECONST,
PhabricatorProjectProjectPHIDType::TYPECONST,
PhabricatorOwnersPackagePHIDType::TYPECONST,
));
}
public function readFieldValueFromObject(DifferentialRevision $revision) {
if (!$revision->getPHID()) {
return array();
}
return PhabricatorSubscribersQuery::loadSubscribersForPHID(
$revision->getPHID());
}
public function readFieldValueFromConduit($value) {
return $this->readStringListFieldValueFromConduit($value);
}
public function renderFieldValue($value) {
return $this->renderHandleList($value);
}
public function getFieldTransactions($value) {
return array(
array(
'type' => PhabricatorSubscriptionsEditEngineExtension::EDITKEY_SET,
'value' => $value,
),
);
}
}