2014-03-08 02:05:00 +01:00
|
|
|
<?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;
|
|
|
|
}
|
|
|
|
|
2014-03-08 18:13:51 +01:00
|
|
|
public function canDisableField() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-08 02:05:00 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-03-13 02:11:09 +01:00
|
|
|
public function parseValueFromCommitMessage($value) {
|
|
|
|
return $this->parseObjectList(
|
|
|
|
$value,
|
|
|
|
array(
|
|
|
|
PhabricatorPeoplePHIDTypeUser::TYPECONST,
|
|
|
|
PhabricatorProjectPHIDTypeProject::TYPECONST,
|
|
|
|
),
|
|
|
|
$allow_partial = true);
|
|
|
|
}
|
|
|
|
|
2014-03-08 02:05:00 +01:00
|
|
|
public function getRequiredHandlePHIDsForCommitMessage() {
|
|
|
|
return $this->getValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderCommitMessageValue(array $handles) {
|
|
|
|
return $this->renderObjectList($handles);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|