1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 17:52:43 +01:00
phorge-phorge/src/applications/differential/field/DifferentialJIRAIssuesCommitMessageField.php
epriestley 24926f9453 Move Differential commit message rendering to dedicated classes
Summary:
Ref T11114. This probably still has some bugs, but survives basic sanity checks.

Continue pulling commit message logic out of CustomField so we can reduce the amount of responsibility/bloat in the classtree and send more code through EditEngine.

Test Plan:
  - Called `differential.getcommitmessage` via API console for various revisions/parameters (edit and create mode, with and without fields, with and without revisions).
  - Used `--create`, `--edit` and `--update` modes of `arc diff` from the CLI.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

43 lines
930 B
PHP

<?php
final class DifferentialJIRAIssuesCommitMessageField
extends DifferentialCommitMessageCustomField {
const FIELDKEY = 'jira.issues';
public function getFieldName() {
return pht('JIRA Issues');
}
public function getFieldAliases() {
return array(
'JIRA',
'JIRA Issue',
);
}
public function getCustomFieldKey() {
return 'phabricator:jira-issues';
}
public function parseFieldValue($value) {
return preg_split('/[\s,]+/', $value, $limit = -1, PREG_SPLIT_NO_EMPTY);
}
protected function readFieldValueFromCustomFieldStorage($value) {
return $this->readJSONFieldValueFromCustomFieldStorage($value, array());
}
public function readFieldValueFromConduit($value) {
return $this->readStringListFieldValueFromConduit($value);
}
public function renderFieldValue($value) {
if (!$value) {
return null;
}
return implode(', ', $value);
}
}