@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow searching Dashboards by Editable

Summary: Ref T10390. I find myself wanting to find dashboards I can edit, even if I am not the author. I think this is useful for larger installs with multiple admins. Also make disabled Dashboards more grey in UI results.

Test Plan: Log in a test user, create a dashboard with I cannot edit. Log into my account, search for editable dashboards and only see mine. Set dashboard to all users, search under test account and see editable dashboards.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10390

Differential Revision: https://secure.phabricator.com/D17524

+26 -1
+15
src/applications/dashboard/query/PhabricatorDashboardQuery.php
··· 7 7 private $phids; 8 8 private $statuses; 9 9 private $authorPHIDs; 10 + private $canEdit; 10 11 11 12 private $needPanels; 12 13 private $needProjects; ··· 41 42 return $this; 42 43 } 43 44 45 + public function withCanEdit($can_edit) { 46 + $this->canEdit = $can_edit; 47 + return $this; 48 + } 49 + 44 50 public function withNameNgrams($ngrams) { 45 51 return $this->withNgramsConstraint( 46 52 id(new PhabricatorDashboardNgrams()), ··· 58 64 protected function didFilterPage(array $dashboards) { 59 65 60 66 $phids = mpull($dashboards, 'getPHID'); 67 + 68 + if ($this->canEdit) { 69 + $dashboards = id(new PhabricatorPolicyFilter()) 70 + ->setViewer($this->getViewer()) 71 + ->requireCapabilities(array( 72 + PhabricatorPolicyCapability::CAN_EDIT, 73 + )) 74 + ->apply($dashboards); 75 + } 61 76 62 77 if ($this->needPanels) { 63 78 $edge_query = id(new PhabricatorEdgeQuery())
+11 -1
src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
··· 34 34 ->setKey('statuses') 35 35 ->setLabel(pht('Status')) 36 36 ->setOptions(PhabricatorDashboard::getStatusNameMap()), 37 + id(new PhabricatorSearchCheckboxesField()) 38 + ->setKey('editable') 39 + ->setLabel(pht('Editable')) 40 + ->setOptions(array('editable' => null)), 37 41 ); 38 42 } 39 43 ··· 94 98 $query->withNameNgrams($map['name']); 95 99 } 96 100 101 + if ($map['editable'] !== null) { 102 + $query->withCanEdit($map['editable']); 103 + } 104 + 97 105 return $query; 98 106 } 99 107 ··· 126 134 ->setHref($this->getApplicationURI("view/{$id}/")) 127 135 ->setObject($dashboard); 128 136 137 + $bg_color = 'bg-dark'; 129 138 if ($dashboard->isArchived()) { 130 139 $item->setDisabled(true); 140 + $bg_color = 'bg-grey'; 131 141 } 132 142 133 143 $panels = $dashboard->getPanels(); ··· 142 152 143 153 $icon = id(new PHUIIconView()) 144 154 ->setIcon($dashboard->getIcon()) 145 - ->setBackground('bg-dark'); 155 + ->setBackground($bg_color); 146 156 $item->setImageIcon($icon); 147 157 $item->setEpoch($dashboard->getDateModified()); 148 158