Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14078332
D17524.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D17524.diff
View Options
diff --git a/src/applications/dashboard/query/PhabricatorDashboardQuery.php b/src/applications/dashboard/query/PhabricatorDashboardQuery.php
--- a/src/applications/dashboard/query/PhabricatorDashboardQuery.php
+++ b/src/applications/dashboard/query/PhabricatorDashboardQuery.php
@@ -7,6 +7,7 @@
private $phids;
private $statuses;
private $authorPHIDs;
+ private $canEdit;
private $needPanels;
private $needProjects;
@@ -41,6 +42,11 @@
return $this;
}
+ public function withCanEdit($can_edit) {
+ $this->canEdit = $can_edit;
+ return $this;
+ }
+
public function withNameNgrams($ngrams) {
return $this->withNgramsConstraint(
id(new PhabricatorDashboardNgrams()),
@@ -59,6 +65,15 @@
$phids = mpull($dashboards, 'getPHID');
+ if ($this->canEdit) {
+ $dashboards = id(new PhabricatorPolicyFilter())
+ ->setViewer($this->getViewer())
+ ->requireCapabilities(array(
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->apply($dashboards);
+ }
+
if ($this->needPanels) {
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($phids)
diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
--- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
+++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
@@ -34,6 +34,10 @@
->setKey('statuses')
->setLabel(pht('Status'))
->setOptions(PhabricatorDashboard::getStatusNameMap()),
+ id(new PhabricatorSearchCheckboxesField())
+ ->setKey('editable')
+ ->setLabel(pht('Editable'))
+ ->setOptions(array('editable' => null)),
);
}
@@ -94,6 +98,10 @@
$query->withNameNgrams($map['name']);
}
+ if ($map['editable'] !== null) {
+ $query->withCanEdit($map['editable']);
+ }
+
return $query;
}
@@ -126,8 +134,10 @@
->setHref($this->getApplicationURI("view/{$id}/"))
->setObject($dashboard);
+ $bg_color = 'bg-dark';
if ($dashboard->isArchived()) {
$item->setDisabled(true);
+ $bg_color = 'bg-grey';
}
$panels = $dashboard->getPanels();
@@ -142,7 +152,7 @@
$icon = id(new PHUIIconView())
->setIcon($dashboard->getIcon())
- ->setBackground('bg-dark');
+ ->setBackground($bg_color);
$item->setImageIcon($icon);
$item->setEpoch($dashboard->getDateModified());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 3:15 AM (17 h, 15 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6776979
Default Alt Text
D17524.diff (2 KB)
Attached To
Mode
D17524: Allow searching Dashboards by Editable
Attached
Detach File
Event Timeline
Log In to Comment