Differential D17066 Diff 41082 src/applications/differential/field/DifferentialReviewedByCommitMessageField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/field/DifferentialReviewedByCommitMessageField.php
| <?php | <?php | ||||
| final class DifferentialReviewedByCommitMessageField | final class DifferentialReviewedByCommitMessageField | ||||
| extends DifferentialCommitMessageField { | extends DifferentialCommitMessageField { | ||||
| const FIELDKEY = 'reviewedByPHIDs'; | const FIELDKEY = 'reviewedByPHIDs'; | ||||
| public function getFieldName() { | public function getFieldName() { | ||||
| return pht('Reviewed By'); | return pht('Reviewed By'); | ||||
| } | } | ||||
| public function getFieldOrder() { | |||||
| return 5000; | |||||
| } | |||||
| public function parseFieldValue($value) { | public function parseFieldValue($value) { | ||||
| return $this->parseObjectList( | return $this->parseObjectList( | ||||
| $value, | $value, | ||||
| array( | array( | ||||
| PhabricatorPeopleUserPHIDType::TYPECONST, | PhabricatorPeopleUserPHIDType::TYPECONST, | ||||
| PhabricatorProjectProjectPHIDType::TYPECONST, | PhabricatorProjectProjectPHIDType::TYPECONST, | ||||
| ), | ), | ||||
| $allow_partial = true); | $allow_partial = true); | ||||
| } | } | ||||
| public function isFieldEditable() { | |||||
| return false; | |||||
| } | |||||
| public function readFieldValueFromObject(DifferentialRevision $revision) { | |||||
| if (!$revision->getPHID()) { | |||||
| return array(); | |||||
| } | |||||
| $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 readFieldValueFromConduit($value) { | |||||
| return $this->readStringListFieldValueFromConduit($value); | |||||
| } | |||||
| public function renderFieldValue($value) { | |||||
| return $this->renderHandleList($value); | |||||
| } | |||||
| } | } | ||||