2014-02-26 23:46:18 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialProjectReviewersField
|
|
|
|
extends DifferentialCustomField {
|
|
|
|
|
|
|
|
public function getFieldKey() {
|
|
|
|
return 'differential:project-reviewers';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldName() {
|
2016-05-13 19:51:35 +02:00
|
|
|
return pht('Coalition Reviewers');
|
2014-02-26 23:46:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getFieldDescription() {
|
|
|
|
return pht('Display project reviewers.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function shouldAppearInPropertyView() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-08 18:13:51 +01:00
|
|
|
public function canDisableField() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
public function renderPropertyViewLabel() {
|
|
|
|
return $this->getFieldName();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getRequiredHandlePHIDsForPropertyView() {
|
|
|
|
return mpull($this->getProjectReviewers(), 'getReviewerPHID');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function renderPropertyViewValue(array $handles) {
|
|
|
|
$reviewers = $this->getProjectReviewers();
|
|
|
|
if (!$reviewers) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$view = id(new DifferentialReviewersView())
|
|
|
|
->setUser($this->getViewer())
|
|
|
|
->setReviewers($reviewers)
|
|
|
|
->setHandles($handles);
|
|
|
|
|
|
|
|
// TODO: Active diff stuff.
|
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
private function getProjectReviewers() {
|
|
|
|
$reviewers = array();
|
|
|
|
foreach ($this->getObject()->getReviewerStatus() as $reviewer) {
|
|
|
|
if (!$reviewer->isUser()) {
|
|
|
|
$reviewers[] = $reviewer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $reviewers;
|
|
|
|
}
|
2014-03-08 02:05:00 +01:00
|
|
|
|
|
|
|
public function getProTips() {
|
|
|
|
return array(
|
|
|
|
pht(
|
|
|
|
'You can add a project as a subscriber or reviewer by writing '.
|
2015-05-22 09:27:56 +02:00
|
|
|
'"%s" in the appropriate field.',
|
|
|
|
'#projectname'),
|
2014-03-08 02:05:00 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2014-02-26 23:46:18 +01:00
|
|
|
}
|