Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15430700
D20533.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
D20533.diff
View Options
diff --git a/src/applications/feed/query/PhabricatorFeedTransactionQuery.php b/src/applications/feed/query/PhabricatorFeedTransactionQuery.php
--- a/src/applications/feed/query/PhabricatorFeedTransactionQuery.php
+++ b/src/applications/feed/query/PhabricatorFeedTransactionQuery.php
@@ -4,6 +4,7 @@
extends PhabricatorCursorPagedPolicyAwareQuery {
private $phids;
+ private $authorPHIDs;
private $createdMin;
private $createdMax;
@@ -12,6 +13,11 @@
return $this;
}
+ public function withAuthorPHIDs(array $phids) {
+ $this->authorPHIDs = $phids;
+ return $this;
+ }
+
public function withDateCreatedBetween($min, $max) {
$this->createdMin = $min;
$this->createdMax = $max;
@@ -59,6 +65,7 @@
$created_max = $this->createdMax;
$xaction_phids = $this->phids;
+ $author_phids = $this->authorPHIDs;
foreach ($queries as $query) {
$query->withDateCreatedBetween($created_min, $created_max);
@@ -67,6 +74,10 @@
$query->withPHIDs($xaction_phids);
}
+ if ($author_phids !== null) {
+ $query->withAuthorPHIDs($author_phids);
+ }
+
if ($limit !== null) {
$query->setLimit($limit);
}
diff --git a/src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php b/src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php
--- a/src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php
+++ b/src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php
@@ -16,12 +16,44 @@
}
protected function buildCustomSearchFields() {
- return array();
+ return array(
+ id(new PhabricatorUsersSearchField())
+ ->setLabel(pht('Authors'))
+ ->setKey('authorPHIDs')
+ ->setAliases(array('author', 'authors')),
+ id(new PhabricatorSearchDateField())
+ ->setLabel(pht('Created After'))
+ ->setKey('createdStart'),
+ id(new PhabricatorSearchDateField())
+ ->setLabel(pht('Created Before'))
+ ->setKey('createdEnd'),
+ );
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
+ if ($map['authorPHIDs']) {
+ $query->withAuthorPHIDs($map['authorPHIDs']);
+ }
+
+ $created_min = $map['createdStart'];
+ $created_max = $map['createdEnd'];
+
+ if ($created_min && $created_max) {
+ if ($created_min > $created_max) {
+ throw new PhabricatorSearchConstraintException(
+ pht(
+ 'The specified "Created Before" date is earlier in time than the '.
+ 'specified "Created After" date, so this query can never match '.
+ 'any results.'));
+ }
+ }
+
+ if ($created_min || $created_max) {
+ $query->withDateCreatedBetween($created_min, $created_max);
+ }
+
return $query;
}
@@ -93,7 +125,7 @@
$table = id(new AphrontTableView($rows))
->setHeaders(
array(
- pht('Actor'),
+ pht('Author'),
pht('Object'),
pht('Transaction'),
pht('Date'),
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 25, 8:36 AM (4 w, 18 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7684186
Default Alt Text
D20533.diff (3 KB)
Attached To
Mode
D20533: Add support for querying feed transactions by author and date range
Attached
Detach File
Event Timeline
Log In to Comment