mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-31 00:48:21 +01:00
Projects - display "members" link in disabled style if user can't edit project
Summary: Fixes T6862. Test Plan: viewed a project list and saw disabled-style "Members" links as appropos Reviewers: epriestley, chad Reviewed By: chad Subscribers: Korvin, epriestley Maniphest Tasks: T6862 Differential Revision: https://secure.phabricator.com/D11229
This commit is contained in:
parent
dd42020ef3
commit
ad1da6ec5e
1 changed files with 15 additions and 2 deletions
|
@ -212,7 +212,12 @@ final class PhabricatorProjectSearchEngine
|
|||
|
||||
$list = new PHUIObjectItemListView();
|
||||
$list->setUser($viewer);
|
||||
foreach ($projects as $project) {
|
||||
$can_edit_projects = id(new PhabricatorPolicyFilter())
|
||||
->setViewer($viewer)
|
||||
->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT))
|
||||
->apply($projects);
|
||||
|
||||
foreach ($projects as $key => $project) {
|
||||
$id = $project->getID();
|
||||
$workboards_uri = $this->getApplicationURI("board/{$id}/");
|
||||
$members_uri = $this->getApplicationURI("members/{$id}/");
|
||||
|
@ -223,10 +228,18 @@ final class PhabricatorProjectSearchEngine
|
|||
),
|
||||
pht('Workboard'));
|
||||
|
||||
$members_url = phutil_tag(
|
||||
$members_class = null;
|
||||
$members_sigil = null;
|
||||
if (!isset($can_edit_projects[$key])) {
|
||||
$members_class = 'disabled';
|
||||
$members_sigil = 'workflow';
|
||||
}
|
||||
$members_url = javelin_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $members_uri,
|
||||
'class' => $members_class,
|
||||
'sigil' => $members_sigil,
|
||||
),
|
||||
pht('Members'));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue