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

Replace legacy Differential queries for "open" revisions with a modern mechanism

Summary: Ref T2543. Several queries want only open revisions. Provide a tailored, non-legacy way to issue that query.

Test Plan: Viewed some of these callsites (e.g., "Similar open revisions affecting these files"), saw only open revisions.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2543

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

+24 -4
+1 -1
src/applications/differential/controller/DifferentialDiffViewController.php
··· 177 177 $revisions = id(new DifferentialRevisionQuery()) 178 178 ->setViewer($viewer) 179 179 ->withAuthors(array($viewer->getPHID())) 180 - ->withStatus(DifferentialLegacyQuery::STATUS_OPEN) 180 + ->withIsOpen(true) 181 181 ->requireCapabilities( 182 182 array( 183 183 PhabricatorPolicyCapability::CAN_VIEW,
+1 -1
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 808 808 809 809 $query = id(new DifferentialRevisionQuery()) 810 810 ->setViewer($this->getRequest()->getUser()) 811 - ->withStatus(DifferentialLegacyQuery::STATUS_OPEN) 811 + ->withIsOpen(true) 812 812 ->withUpdatedEpochBetween($recent, null) 813 813 ->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED) 814 814 ->setLimit(10)
+20
src/applications/differential/query/DifferentialRevisionQuery.php
··· 26 26 private $updatedEpochMin; 27 27 private $updatedEpochMax; 28 28 private $statuses; 29 + private $isOpen; 29 30 30 31 const ORDER_MODIFIED = 'order-modified'; 31 32 const ORDER_CREATED = 'order-created'; ··· 149 150 150 151 public function withStatuses(array $statuses) { 151 152 $this->statuses = $statuses; 153 + return $this; 154 + } 155 + 156 + public function withIsOpen($is_open) { 157 + $this->isOpen = $is_open; 152 158 return $this; 153 159 } 154 160 ··· 716 722 $conn_r, 717 723 'r.status in (%Ls)', 718 724 DifferentialLegacyQuery::getLegacyValues($this->statuses)); 725 + } 726 + 727 + if ($this->isOpen !== null) { 728 + if ($this->isOpen) { 729 + $statuses = DifferentialLegacyQuery::getQueryValues( 730 + DifferentialLegacyQuery::STATUS_OPEN); 731 + } else { 732 + $statuses = DifferentialLegacyQuery::getQueryValues( 733 + DifferentialLegacyQuery::STATUS_CLOSED); 734 + } 735 + $where[] = qsprintf( 736 + $conn_r, 737 + 'r.status in (%Ls)', 738 + $statuses); 719 739 } 720 740 721 741 $where[] = $this->buildWhereClauseParts($conn_r);
+1 -1
src/applications/differential/query/DifferentialRevisionSearchEngine.php
··· 268 268 $blocking_revisions = id(new DifferentialRevisionQuery()) 269 269 ->setViewer($viewer) 270 270 ->withPHIDs($revision_phids) 271 - ->withStatus(DifferentialLegacyQuery::STATUS_OPEN) 271 + ->withIsOpen(true) 272 272 ->execute(); 273 273 $blocking_revisions = mpull($blocking_revisions, null, 'getPHID'); 274 274
+1 -1
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 1758 1758 $revisions = id(new DifferentialRevisionQuery()) 1759 1759 ->setViewer($viewer) 1760 1760 ->withPath($repository->getID(), $path_id) 1761 - ->withStatus(DifferentialLegacyQuery::STATUS_OPEN) 1761 + ->withIsOpen(true) 1762 1762 ->withUpdatedEpochBetween($recent, null) 1763 1763 ->setOrder(DifferentialRevisionQuery::ORDER_MODIFIED) 1764 1764 ->setLimit(10)