Page MenuHomePhabricator

D14782.id35751.diff
No OneTemporary

D14782.id35751.diff

diff --git a/src/applications/conduit/query/PhabricatorConduitLogQuery.php b/src/applications/conduit/query/PhabricatorConduitLogQuery.php
--- a/src/applications/conduit/query/PhabricatorConduitLogQuery.php
+++ b/src/applications/conduit/query/PhabricatorConduitLogQuery.php
@@ -3,9 +3,15 @@
final class PhabricatorConduitLogQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
+ private $callerPHIDs;
private $methods;
private $methodStatuses;
+ public function withCallerPHIDs(array $phids) {
+ $this->callerPHIDs = $phids;
+ return $this;
+ }
+
public function withMethods(array $methods) {
$this->methods = $methods;
return $this;
@@ -27,6 +33,13 @@
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = parent::buildWhereClauseParts($conn);
+ if ($this->callerPHIDs !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'callerPHID IN (%Ls)',
+ $this->callerPHIDs);
+ }
+
if ($this->methods !== null) {
$where[] = qsprintf(
$conn,
diff --git a/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
--- a/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
+++ b/src/applications/conduit/query/PhabricatorConduitLogSearchEngine.php
@@ -18,6 +18,10 @@
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
+ if ($map['callerPHIDs']) {
+ $query->withCallerPHIDs($map['callerPHIDs']);
+ }
+
if ($map['methods']) {
$query->withMethods($map['methods']);
}
@@ -31,6 +35,11 @@
protected function buildCustomSearchFields() {
return array(
+ id(new PhabricatorUsersSearchField())
+ ->setKey('callerPHIDs')
+ ->setLabel(pht('Methods'))
+ ->setAliases(array('caller', 'callers'))
+ ->setDescription(pht('Find calls by specific users.')),
id(new PhabricatorSearchStringListField())
->setKey('methods')
->setLabel(pht('Methods'))
@@ -39,6 +48,8 @@
->setKey('statuses')
->setLabel(pht('Method Status'))
->setAliases(array('status'))
+ ->setDescription(
+ pht('Find calls to stable, unstable, or deprecated methods.'))
->setOptions(ConduitAPIMethod::getMethodStatusMap()),
);
}
@@ -48,10 +59,16 @@
}
protected function getBuiltinQueryNames() {
- $names = array(
- 'all' => pht('All Logs'),
- 'deprecated' => pht('Deprecated Calls'),
- );
+ $names = array();
+
+ $viewer = $this->requireViewer();
+ if ($viewer->isLoggedIn()) {
+ $names['viewer'] = pht('My Calls');
+ $names['viewerdeprecated'] = pht('My Deprecated Calls');
+ }
+
+ $names['all'] = pht('All Call Logs');
+ $names['deprecated'] = pht('Deprecated Call Logs');
return $names;
}
@@ -60,13 +77,24 @@
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
+ $viewer = $this->requireViewer();
+ $viewer_phid = $viewer->getPHID();
+
+ $deprecated = array(
+ ConduitAPIMethod::METHOD_STATUS_DEPRECATED,
+ );
+
switch ($query_key) {
+ case 'viewer':
+ return $query
+ ->setParameter('callerPHIDs', array($viewer_phid));
+ case 'viewerdeprecated':
+ return $query
+ ->setParameter('callerPHIDs', array($viewer_phid))
+ ->setParameter('statuses', $deprecated);
case 'deprecated':
- return $query->setParameter(
- 'statuses',
- array(
- ConduitAPIMethod::METHOD_STATUS_DEPRECATED,
- ));
+ return $query
+ ->setParameter('statuses', $deprecated);
case 'all':
return $query;
}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 7, 3:22 PM (5 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6720673
Default Alt Text
D14782.id35751.diff (3 KB)

Event Timeline