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

Remove legacy `withStatus()` method from RevisionQuery

Summary: Ref T2543. All callsites are now in terms of `withStatuses()`.

Test Plan:
- Called `differential.query` and `differential.find` from Conduit API.
- Grepped through all `withStatus()` callsites.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2543

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

+11 -34
+2 -2
src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
··· 52 52 switch ($type) { 53 53 case 'open': 54 54 $query 55 - ->withStatus(DifferentialLegacyQuery::STATUS_OPEN) 55 + ->withIsOpen(true) 56 56 ->withAuthors($guids); 57 57 break; 58 58 case 'committable': 59 59 $query 60 - ->withStatus(DifferentialLegacyQuery::STATUS_ACCEPTED) 60 + ->withStatuses(DifferentialRevisionStatus::ACCEPTED) 61 61 ->withAuthors($guids); 62 62 break; 63 63 case 'revision-ids':
+4 -1
src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
··· 150 150 } 151 151 152 152 if ($status) { 153 - $query->withStatus($status); 153 + $statuses = DifferentialLegacyQuery::getModernValues($status); 154 + if ($statuses) { 155 + $query->withStatuses($statuses); 156 + } 154 157 } 155 158 if ($order) { 156 159 $query->setOrder($order);
+2 -2
src/applications/differential/constants/DifferentialLegacyQuery.php
··· 15 15 return array_keys(self::getMap()); 16 16 } 17 17 18 - public static function getQueryValues($status) { 18 + public static function getModernValues($status) { 19 19 if ($status === self::STATUS_ANY) { 20 20 return null; 21 21 } ··· 28 28 $status)); 29 29 } 30 30 31 - return self::getLegacyValues($map[$status]); 31 + return $map[$status]; 32 32 } 33 33 34 34 public static function getLegacyValues(array $modern_values) {
+3 -29
src/applications/differential/query/DifferentialRevisionQuery.php
··· 10 10 11 11 private $pathIDs = array(); 12 12 13 - private $status = 'status-any'; 14 - 15 13 private $authors = array(); 16 14 private $draftAuthors = array(); 17 15 private $ccs = array(); ··· 132 130 */ 133 131 public function withCommitPHIDs(array $commit_phids) { 134 132 $this->commitPHIDs = $commit_phids; 135 - return $this; 136 - } 137 - 138 - /** 139 - * Filter results to revisions with a given status. Provide a class constant, 140 - * such as `DifferentialLegacyQuery::STATUS_OPEN`. 141 - * 142 - * @param const Class STATUS constant, like STATUS_OPEN. 143 - * @return this 144 - * @task config 145 - */ 146 - public function withStatus($status_constant) { 147 - $this->status = $status_constant; 148 133 return $this; 149 134 } 150 135 ··· 706 691 $this->updatedEpochMax); 707 692 } 708 693 709 - // NOTE: Although the status constants are integers in PHP, the column is a 710 - // string column in MySQL, and MySQL won't use keys on string columns if 711 - // you put integers in the query. 712 - $statuses = DifferentialLegacyQuery::getQueryValues($this->status); 713 - if ($statuses !== null) { 714 - $where[] = qsprintf( 715 - $conn_r, 716 - 'r.status IN (%Ls)', 717 - $statuses); 718 - } 719 - 720 694 if ($this->statuses !== null) { 721 695 $where[] = qsprintf( 722 696 $conn_r, ··· 726 700 727 701 if ($this->isOpen !== null) { 728 702 if ($this->isOpen) { 729 - $statuses = DifferentialLegacyQuery::getQueryValues( 703 + $statuses = DifferentialLegacyQuery::getModernValues( 730 704 DifferentialLegacyQuery::STATUS_OPEN); 731 705 } else { 732 - $statuses = DifferentialLegacyQuery::getQueryValues( 706 + $statuses = DifferentialLegacyQuery::getModernValues( 733 707 DifferentialLegacyQuery::STATUS_CLOSED); 734 708 } 735 709 $where[] = qsprintf( 736 710 $conn_r, 737 711 'r.status in (%Ls)', 738 - $statuses); 712 + DifferentialLegacyQuery::getLegacyValues($statuses)); 739 713 } 740 714 741 715 $where[] = $this->buildWhereClauseParts($conn_r);