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

Clean up Diffusion tag list query a bit

Summary:
- Use DiffusionCommitQuery.
- Use denormalized summary.
- Use stronger "Importing" test.

Test Plan: Viewed `/diffusion/X/` for repos with tags. Saw tags; saw importing commits marked as "Importing" instead of "Unknown".

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

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

+25 -23
+22 -20
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 225 225 ->withRepositoryIDs(array($drequest->getRepository()->getID())) 226 226 ->execute(); 227 227 228 - $table = new DiffusionBranchTableView(); 229 - $table->setDiffusionRequest($drequest); 230 - $table->setBranches($branches); 231 - $table->setCommits($commits); 232 - $table->setUser($this->getRequest()->getUser()); 228 + $table = id(new DiffusionBranchTableView()) 229 + ->setUser($viewer) 230 + ->setDiffusionRequest($drequest) 231 + ->setBranches($branches) 232 + ->setCommits($commits); 233 233 234 - $panel = new AphrontPanelView(); 235 - $panel->setHeader(pht('Branches')); 236 - $panel->setNoBackground(); 234 + $panel = id(new AphrontPanelView()) 235 + ->setHeader(pht('Branches')) 236 + ->setNoBackground(); 237 237 238 238 if ($more_branches) { 239 239 $panel->setCaption(pht('Showing %d branches.', $limit)); ··· 257 257 } 258 258 259 259 private function buildTagListTable(DiffusionRequest $drequest) { 260 + $viewer = $this->getRequest()->getUser(); 261 + 260 262 $tag_limit = 15; 261 263 $tags = array(); 262 264 try { ··· 281 283 $more_tags = (count($tags) > $tag_limit); 282 284 $tags = array_slice($tags, 0, $tag_limit); 283 285 284 - $commits = id(new PhabricatorAuditCommitQuery()) 285 - ->withIdentifiers( 286 - $drequest->getRepository()->getID(), 287 - mpull($tags, 'getCommitIdentifier')) 286 + $commits = id(new DiffusionCommitQuery()) 287 + ->setViewer($viewer) 288 + ->withIdentifiers(mpull($tags, 'getCommitIdentifier')) 289 + ->withRepositoryIDs(array($drequest->getRepository()->getID())) 288 290 ->needCommitData(true) 289 291 ->execute(); 290 292 291 - $view = new DiffusionTagListView(); 292 - $view->setDiffusionRequest($drequest); 293 - $view->setTags($tags); 294 - $view->setUser($this->getRequest()->getUser()); 295 - $view->setCommits($commits); 293 + $view = id(new DiffusionTagListView()) 294 + ->setUser($viewer) 295 + ->setDiffusionRequest($drequest) 296 + ->setTags($tags) 297 + ->setCommits($commits); 296 298 297 299 $phids = $view->getRequiredHandlePHIDs(); 298 300 $handles = $this->loadViewerHandles($phids); 299 301 $view->setHandles($handles); 300 302 301 - $panel = new AphrontPanelView(); 302 - $panel->setHeader(pht('Tags')); 303 - $panel->setNoBackground(true); 303 + $panel = id(new AphrontPanelView()) 304 + ->setHeader(pht('Tags')) 305 + ->setNoBackground(true); 304 306 305 307 if ($more_tags) { 306 308 $panel->setCaption(pht('Showing the %d most recent tags.', $tag_limit));
+1 -1
src/applications/diffusion/view/DiffusionHistoryTableView.php
··· 113 113 } 114 114 115 115 $commit = $history->getCommit(); 116 - if ($commit && !$commit->getIsUnparsed() && $data) { 116 + if ($commit && $commit->isImported() && $data) { 117 117 $change = $this->linkChange( 118 118 $history->getChangeType(), 119 119 $history->getFileType(),
+2 -2
src/applications/diffusion/view/DiffusionTagListView.php
··· 73 73 // unique data which isn't otherwise available. 74 74 $description = $tag->getDescription(); 75 75 } else { 76 - if ($commit && $commit->getCommitData()) { 77 - $description = $commit->getCommitData()->getSummary(); 76 + if ($commit) { 77 + $description = $commit->getSummary(); 78 78 } else { 79 79 $description = $tag->getDescription(); 80 80 }