@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.

Add support for querying feed transactions by author and date range

Summary: Depends on D20531. Ref T13294. Enable finding raw transactions in particular date ranges or with particular authors.

Test Plan: {F6463471}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13294

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

+45 -2
+11
src/applications/feed/query/PhabricatorFeedTransactionQuery.php
··· 4 4 extends PhabricatorCursorPagedPolicyAwareQuery { 5 5 6 6 private $phids; 7 + private $authorPHIDs; 7 8 private $createdMin; 8 9 private $createdMax; 9 10 10 11 public function withPHIDs(array $phids) { 11 12 $this->phids = $phids; 13 + return $this; 14 + } 15 + 16 + public function withAuthorPHIDs(array $phids) { 17 + $this->authorPHIDs = $phids; 12 18 return $this; 13 19 } 14 20 ··· 59 65 $created_max = $this->createdMax; 60 66 61 67 $xaction_phids = $this->phids; 68 + $author_phids = $this->authorPHIDs; 62 69 63 70 foreach ($queries as $query) { 64 71 $query->withDateCreatedBetween($created_min, $created_max); 65 72 66 73 if ($xaction_phids !== null) { 67 74 $query->withPHIDs($xaction_phids); 75 + } 76 + 77 + if ($author_phids !== null) { 78 + $query->withAuthorPHIDs($author_phids); 68 79 } 69 80 70 81 if ($limit !== null) {
+34 -2
src/applications/feed/query/PhabricatorFeedTransactionSearchEngine.php
··· 16 16 } 17 17 18 18 protected function buildCustomSearchFields() { 19 - return array(); 19 + return array( 20 + id(new PhabricatorUsersSearchField()) 21 + ->setLabel(pht('Authors')) 22 + ->setKey('authorPHIDs') 23 + ->setAliases(array('author', 'authors')), 24 + id(new PhabricatorSearchDateField()) 25 + ->setLabel(pht('Created After')) 26 + ->setKey('createdStart'), 27 + id(new PhabricatorSearchDateField()) 28 + ->setLabel(pht('Created Before')) 29 + ->setKey('createdEnd'), 30 + ); 20 31 } 21 32 22 33 protected function buildQueryFromParameters(array $map) { 23 34 $query = $this->newQuery(); 35 + 36 + if ($map['authorPHIDs']) { 37 + $query->withAuthorPHIDs($map['authorPHIDs']); 38 + } 39 + 40 + $created_min = $map['createdStart']; 41 + $created_max = $map['createdEnd']; 42 + 43 + if ($created_min && $created_max) { 44 + if ($created_min > $created_max) { 45 + throw new PhabricatorSearchConstraintException( 46 + pht( 47 + 'The specified "Created Before" date is earlier in time than the '. 48 + 'specified "Created After" date, so this query can never match '. 49 + 'any results.')); 50 + } 51 + } 52 + 53 + if ($created_min || $created_max) { 54 + $query->withDateCreatedBetween($created_min, $created_max); 55 + } 24 56 25 57 return $query; 26 58 } ··· 93 125 $table = id(new AphrontTableView($rows)) 94 126 ->setHeaders( 95 127 array( 96 - pht('Actor'), 128 + pht('Author'), 97 129 pht('Object'), 98 130 pht('Transaction'), 99 131 pht('Date'),