1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 16:22:43 +01:00

When a reviewer can't see a revision, show it clearly in the reviewer list

Summary: Ref T13602. Similar to subscriber and mention treatments, make it clear when a user doesn't have view permission.

Test Plan: {F8430595}

Maniphest Tasks: T13602

Differential Revision: https://secure.phabricator.com/D21555
This commit is contained in:
epriestley 2021-02-13 13:09:36 -08:00
parent 90903282c7
commit 2f33dedc8b
5 changed files with 51 additions and 10 deletions

View file

@ -9,7 +9,7 @@ return array(
'names' => array(
'conpherence.pkg.css' => '0e3cf785',
'conpherence.pkg.js' => '020aebcf',
'core.pkg.css' => '7cb6808c',
'core.pkg.css' => '0ae696de',
'core.pkg.js' => '079198f6',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => '5c459f92',
@ -180,7 +180,7 @@ return array(
'rsrc/css/phui/phui-remarkup-preview.css' => '91767007',
'rsrc/css/phui/phui-segment-bar-view.css' => '5166b370',
'rsrc/css/phui/phui-spacing.css' => 'b05cadc3',
'rsrc/css/phui/phui-status.css' => 'e5ff8be0',
'rsrc/css/phui/phui-status.css' => '293b5dad',
'rsrc/css/phui/phui-tag-view.css' => 'fb811341',
'rsrc/css/phui/phui-timeline-view.css' => '2d32d7a9',
'rsrc/css/phui/phui-two-column-view.css' => 'f96d319f',
@ -885,7 +885,7 @@ return array(
'phui-remarkup-preview-css' => '91767007',
'phui-segment-bar-view-css' => '5166b370',
'phui-spacing-css' => 'b05cadc3',
'phui-status-list-view-css' => 'e5ff8be0',
'phui-status-list-view-css' => '293b5dad',
'phui-tag-view-css' => 'fb811341',
'phui-theme-css' => '35883b37',
'phui-timeline-view-css' => '2d32d7a9',

View file

@ -26,6 +26,8 @@ final class DifferentialReviewersView extends AphrontView {
public function render() {
$viewer = $this->getUser();
$reviewers = $this->reviewers;
$diff = $this->diff;
$handles = $this->handles;
$view = new PHUIStatusListView();
@ -40,10 +42,15 @@ final class DifferentialReviewersView extends AphrontView {
}
}
PhabricatorPolicyFilterSet::loadHandleViewCapabilities(
$viewer,
$handles,
array($diff));
$reviewers = $head + $tail;
foreach ($reviewers as $reviewer) {
$phid = $reviewer->getReviewerPHID();
$handle = $this->handles[$phid];
$handle = $handles[$phid];
$action_phid = $reviewer->getLastActionDiffPHID();
$is_current_action = $this->isCurrent($action_phid);
@ -154,7 +161,10 @@ final class DifferentialReviewersView extends AphrontView {
}
$item->setIcon($icon, $color, $label);
$item->setTarget($handle->renderHovercardLink());
$item->setTarget(
$handle->renderHovercardLink(
null,
$diff->getPHID()));
if ($reviewer->isPackage()) {
if (!$reviewer->getChangesets()) {
@ -162,6 +172,15 @@ final class DifferentialReviewersView extends AphrontView {
}
}
if ($handle->hasCapabilities()) {
if (!$handle->hasViewCapability($diff)) {
$item
->setIcon('fa-eye-slash', 'red')
->setNote(pht('No View Permission'))
->setIsExiled(true);
}
}
$view->addItem($item);
}

View file

@ -300,15 +300,21 @@ final class PhabricatorObjectHandle
return $this->renderLinkWithAttributes($name, array());
}
public function renderHovercardLink($name = null) {
public function renderHovercardLink($name = null, $context_phid = null) {
Javelin::initBehavior('phui-hovercards');
$hovercard_spec = array(
'objectPHID' => $this->getPHID(),
);
if ($context_phid) {
$hovercard_spec['contextPHID'] = $context_phid;
}
$attributes = array(
'sigil' => 'hovercard',
'meta' => array(
'hovercardSpec' => array(
'objectPHID' => $this->getPHID(),
),
'hovercardSpec' => $hovercard_spec,
),
);

View file

@ -8,6 +8,7 @@ final class PHUIStatusItemView extends AphrontTagView {
private $target;
private $note;
private $highlighted;
private $isExiled;
const ICON_ACCEPT = 'fa-check-circle';
const ICON_REJECT = 'fa-times-circle';
@ -46,6 +47,11 @@ final class PHUIStatusItemView extends AphrontTagView {
return $this;
}
public function setIsExiled($is_exiled) {
$this->isExiled = $is_exiled;
return $this;
}
protected function canAppendChild() {
return false;
}
@ -60,6 +66,10 @@ final class PHUIStatusItemView extends AphrontTagView {
$classes[] = 'phui-status-item-highlighted';
}
if ($this->isExiled) {
$classes[] = 'phui-status-item-exiled';
}
return array(
'class' => $classes,
);

View file

@ -29,10 +29,16 @@
border-radius: 3px;
}
.phui-status-item-exiled td {
background-color: {$lightredbackground};
border-radius: 3px;
}
.phui-status-list-view td a {
color: {$darkbluetext};
}
.phui-status-item-highlighted td.phui-status-item-note {
.phui-status-item-highlighted td.phui-status-item-note,
.phui-status-item-exiled td.phui-status-item-note {
background-color: transparent;
}