mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 11:52:40 +01:00
70ddb1c45f
Summary: Ref T10939. This lets you add packages as reviewers manually. "Project Reviewers" now lists both projects and packages. I have renamed this to "Coalition Reviewers" but that's probably horrible and confusing. I'm not sure "Group Reviewers" is much better. Test Plan: - Added a package as a reviewer manually. - Joined it, got authority over it. - Saw the review on my dashboard. - Accepted the revision, got authority extended to the package review. {F1311652} {F1311653} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10939 Differential Revision: https://secure.phabricator.com/D15914
69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class DifferentialProjectReviewersField
|
|
extends DifferentialCustomField {
|
|
|
|
public function getFieldKey() {
|
|
return 'differential:project-reviewers';
|
|
}
|
|
|
|
public function getFieldName() {
|
|
return pht('Coalition Reviewers');
|
|
}
|
|
|
|
public function getFieldDescription() {
|
|
return pht('Display project reviewers.');
|
|
}
|
|
|
|
public function shouldAppearInPropertyView() {
|
|
return true;
|
|
}
|
|
|
|
public function canDisableField() {
|
|
return false;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
public function getProTips() {
|
|
return array(
|
|
pht(
|
|
'You can add a project as a subscriber or reviewer by writing '.
|
|
'"%s" in the appropriate field.',
|
|
'#projectname'),
|
|
);
|
|
}
|
|
|
|
}
|