1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

When a package or project has been accepted or rejected, show who did it ("Accepted (by dog)")

Summary: Makes it more clear whose authority actions have been taken under.

Test Plan: {F4916376}

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D17741
This commit is contained in:
epriestley 2017-04-19 16:34:23 -07:00
parent 6969e9389f
commit 7a992b5488
2 changed files with 62 additions and 41 deletions

View file

@ -643,7 +643,7 @@ abstract class PhabricatorApplication
public function getApplicationTransactionEditor() { public function getApplicationTransactionEditor() {
return new PhabricatorApplicationEditor(); return new PhutilMethodNotImplementedException(pht('Coming Soon!'));
} }
public function getApplicationTransactionObject() { public function getApplicationTransactionObject() {

View file

@ -55,80 +55,101 @@ final class DifferentialReviewersView extends AphrontView {
$item->setHighlighted($reviewer->hasAuthority($viewer)); $item->setHighlighted($reviewer->hasAuthority($viewer));
// If someone other than the reviewer acted on the reviewer's behalf,
// show who is responsible for the current state. This is usually a
// user accepting for a package or project.
$authority_phid = $reviewer->getLastActorPHID();
if ($authority_phid && ($authority_phid !== $phid)) {
$authority_name = $viewer->renderHandle($authority_phid)
->setAsText(true);
} else {
$authority_name = null;
}
switch ($reviewer->getReviewerStatus()) { switch ($reviewer->getReviewerStatus()) {
case DifferentialReviewerStatus::STATUS_ADDED: case DifferentialReviewerStatus::STATUS_ADDED:
if ($comment_phid) { if ($comment_phid) {
if ($is_current_comment) { if ($is_current_comment) {
$item->setIcon( $icon = 'fa-comment';
'fa-comment', $color = 'blue';
'blue', $label = pht('Commented');
pht('Commented'));
} else { } else {
$item->setIcon( $icon = 'fa-comment-o';
'fa-comment-o', $color = 'bluegrey';
'bluegrey', $label = pht('Commented Previously');
pht('Commented Previously'));
} }
} else { } else {
$item->setIcon( $icon = PHUIStatusItemView::ICON_OPEN;
PHUIStatusItemView::ICON_OPEN, $color = 'bluegrey';
'bluegrey', $label = pht('Review Requested');
pht('Review Requested'));
} }
break; break;
case DifferentialReviewerStatus::STATUS_ACCEPTED: case DifferentialReviewerStatus::STATUS_ACCEPTED:
if ($is_current_action) { if ($is_current_action) {
$item->setIcon( $icon = PHUIStatusItemView::ICON_ACCEPT;
PHUIStatusItemView::ICON_ACCEPT, $color = 'green';
'green', if ($authority_name !== null) {
pht('Accepted')); $label = pht('Accepted (by %s)', $authority_name);
} else {
$label = pht('Accepted');
}
} else { } else {
$item->setIcon( $icon = 'fa-check-circle-o';
'fa-check-circle-o', $color = 'bluegrey';
'bluegrey', if ($authority_name !== null) {
pht('Accepted Prior Diff')); $label = pht('Accepted Prior Diff (by %s)', $authority_name);
} else {
$label = pht('Accepted Prior Diff');
}
} }
break; break;
case DifferentialReviewerStatus::STATUS_REJECTED: case DifferentialReviewerStatus::STATUS_REJECTED:
if ($is_current_action) { if ($is_current_action) {
$item->setIcon( $icon = PHUIStatusItemView::ICON_REJECT;
PHUIStatusItemView::ICON_REJECT, $color = 'red';
'red', if ($authority_name !== null) {
pht('Requested Changes')); $label = pht('Requested Changes (by %s)', $authority_name);
} else {
$label = pht('Requested Changes');
}
} else { } else {
$item->setIcon( $icon = 'fa-times-circle-o';
'fa-times-circle-o', $color = 'bluegrey';
'bluegrey', if ($authority_name !== null) {
pht('Requested Changes to Prior Diff')); $label = pht(
'Requested Changes to Prior Diff (by %s)',
$authority_name);
} else {
$label = pht('Requested Changes to Prior Diff');
}
} }
break; break;
case DifferentialReviewerStatus::STATUS_BLOCKING: case DifferentialReviewerStatus::STATUS_BLOCKING:
$item->setIcon( $icon = PHUIStatusItemView::ICON_MINUS;
PHUIStatusItemView::ICON_MINUS, $color = 'red';
'red', $label = pht('Blocking Review');
pht('Blocking Review'));
break; break;
case DifferentialReviewerStatus::STATUS_RESIGNED: case DifferentialReviewerStatus::STATUS_RESIGNED:
$item->setIcon( $icon = 'fa-times';
'fa-times', $color = 'grey';
'grey', $label = pht('Resigned');
pht('Resigned'));
break; break;
default: default:
$item->setIcon( $icon = PHUIStatusItemView::ICON_QUESTION;
PHUIStatusItemView::ICON_QUESTION, $color = 'bluegrey';
'bluegrey', $label = pht('Unknown ("%s")', $reviewer->getReviewerStatus());
pht('%s?', $reviewer->getReviewerStatus()));
break; break;
} }
$item->setIcon($icon, $color, $label);
$item->setTarget($handle->renderHovercardLink()); $item->setTarget($handle->renderHovercardLink());
$view->addItem($item); $view->addItem($item);
} }