Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19095672
D17022.id40949.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D17022.id40949.diff
View Options
diff --git a/resources/sql/autopatches/20161210.dashboards.01.author.sql b/resources/sql/autopatches/20161210.dashboards.01.author.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20161210.dashboards.01.author.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_dashboard.dashboard
+ ADD authorPHID VARBINARY(64);
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
@@ -6,6 +6,7 @@
private $ids;
private $phids;
private $statuses;
+ private $authorPHIDs;
private $needPanels;
private $needProjects;
@@ -25,6 +26,11 @@
return $this;
}
+ public function withAuthors(array $authors) {
+ $this->authorPHIDs = $authors;
+ return $this;
+ }
+
public function needPanels($need_panels) {
$this->needPanels = $need_panels;
return $this;
@@ -121,6 +127,13 @@
$this->statuses);
}
+ if ($this->authorPHIDs !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'authorPHID IN (%Ls)',
+ $this->authorPHIDs);
+ }
+
return $where;
}
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
@@ -18,6 +18,10 @@
protected function buildCustomSearchFields() {
return array(
+ id(new PhabricatorSearchDatasourceField())
+ ->setLabel(pht('Authored By'))
+ ->setKey('authored')
+ ->setDatasource(new PhabricatorPeopleDatasource()),
id(new PhabricatorSearchCheckboxesField())
->setKey('statuses')
->setLabel(pht('Status'))
@@ -30,19 +34,32 @@
}
protected function getBuiltinQueryNames() {
- return array(
- 'open' => pht('Active Dashboards'),
- 'all' => pht('All Dashboards'),
- );
+ $names = array();
+
+ if ($this->requireViewer()->isLoggedIn()) {
+ $names['authored'] = pht('Authored');
+ }
+
+ $names['open'] = pht('Active Dashboards');
+ $names['all'] = pht('All Dashboards');
+
+ return $names;
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
+ $viewer = $this->requireViewer();
switch ($query_key) {
case 'all':
return $query;
+ case 'authored':
+ return $query->setParameter(
+ 'authored',
+ array(
+ $viewer->getPHID(),
+ ));
case 'open':
return $query->setParameter(
'statuses',
@@ -61,6 +78,10 @@
$query->withStatuses($map['statuses']);
}
+ if ($map['authored']) {
+ $query->withAuthors($map['authored']);
+ }
+
return $query;
}
diff --git a/src/applications/dashboard/storage/PhabricatorDashboard.php b/src/applications/dashboard/storage/PhabricatorDashboard.php
--- a/src/applications/dashboard/storage/PhabricatorDashboard.php
+++ b/src/applications/dashboard/storage/PhabricatorDashboard.php
@@ -12,6 +12,7 @@
PhabricatorProjectInterface {
protected $name;
+ protected $authorPHID;
protected $viewPolicy;
protected $editPolicy;
protected $status;
@@ -31,6 +32,7 @@
->setViewPolicy(PhabricatorPolicies::POLICY_USER)
->setEditPolicy($actor->getPHID())
->setStatus(self::STATUS_ACTIVE)
+ ->setAuthorPHID($actor->getPHID())
->attachPanels(array())
->attachPanelPHIDs(array());
}
@@ -61,6 +63,7 @@
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255',
'status' => 'text32',
+ 'authorPHID' => 'phid?',
),
) + parent::getConfiguration();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 5, 5:49 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
12815017
Default Alt Text
D17022.id40949.diff (3 KB)
Attached To
Mode
D17022: Add authorPHID to Dashboards
Attached
Detach File
Event Timeline
Log In to Comment