mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 03:42:41 +01:00
8a409aa40f
Summary: In the Message parser, we read this field and expect to get an array of PHIDs out of it. Currently, we get a string. Instead, get an array of PHIDs. Test Plan: Wrote a message like "Fixes Tnnn" with "Reviewed by: duck", and saw no more parse error during message parsing. Reviewers: btrahan Reviewed By: btrahan Subscribers: aran, epriestley Differential Revision: https://secure.phabricator.com/D8510
72 lines
1.6 KiB
PHP
72 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class DifferentialReviewedByField
|
|
extends DifferentialCoreCustomField {
|
|
|
|
public function getFieldKey() {
|
|
return 'differential:reviewed-by';
|
|
}
|
|
|
|
public function getFieldKeyForConduit() {
|
|
return 'reviewedByPHIDs';
|
|
}
|
|
|
|
public function getFieldName() {
|
|
return pht('Reviewed By');
|
|
}
|
|
|
|
public function getFieldDescription() {
|
|
return pht('Records accepting reviewers in the durable message.');
|
|
}
|
|
|
|
public function shouldAppearInApplicationTransactions() {
|
|
return false;
|
|
}
|
|
|
|
public function shouldAppearInEditView() {
|
|
return false;
|
|
}
|
|
|
|
public function canDisableField() {
|
|
return true;
|
|
}
|
|
|
|
protected function readValueFromRevision(
|
|
DifferentialRevision $revision) {
|
|
|
|
$phids = array();
|
|
foreach ($revision->getReviewerStatus() as $reviewer) {
|
|
switch ($reviewer->getStatus()) {
|
|
case DifferentialReviewerStatus::STATUS_ACCEPTED:
|
|
case DifferentialReviewerStatus::STATUS_ACCEPTED_OLDER:
|
|
$phids[] = $reviewer->getReviewerPHID();
|
|
break;
|
|
}
|
|
}
|
|
|
|
return $phids;
|
|
}
|
|
|
|
public function shouldAppearInCommitMessage() {
|
|
return true;
|
|
}
|
|
|
|
public function parseValueFromCommitMessage($value) {
|
|
return $this->parseObjectList(
|
|
$value,
|
|
array(
|
|
PhabricatorPeoplePHIDTypeUser::TYPECONST,
|
|
PhabricatorProjectPHIDTypeProject::TYPECONST,
|
|
),
|
|
$allow_partial = true);
|
|
}
|
|
|
|
public function getRequiredHandlePHIDsForCommitMessage() {
|
|
return $this->getValue();
|
|
}
|
|
|
|
public function renderCommitMessageValue(array $handles) {
|
|
return $this->renderObjectList($handles);
|
|
}
|
|
|
|
}
|