@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 history query from DiffusionRepositoryController as it is unused

Summary:
The history query for the repository page isn't actually used to display any content. It looks like it was previously used to display the last user which modified a file however this looks to be removed in D21404. This removes the history query from happening as well as updates `DiffusionBrowseTableView` to remove the parameters for passing this information in, resulting in also updating `DiffusionBrowseController` to no longer need to put this information together.

Refs T13666

Test Plan:
1. I removed commits from a repository on the local state.
2. I navigated to the repository's landing page and saw that the landing page attempted to render content and only failed to load the browse files section.
3. I navigated to the history tab and verified that it showed an exception about failing to query commit information.
4. I restored the repository working state to function properly.
5. I navigated to a repository's landing page and verified it loaded properly, including showing the last modified date for each file.
6. I navigated to the Code, Branches, Tags, and History tabs to verify each tab page loaded properly.
7. I verified on the Code tab that the last modified date for each file displayed properly.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T13666

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

+1 -75
-14
src/applications/diffusion/controller/DiffusionBrowseController.php
··· 298 298 $empty_result->setDiffusionBrowseResultSet($results); 299 299 $empty_result->setView($request->getStr('view')); 300 300 } else { 301 - $phids = array(); 302 - foreach ($results->getPaths() as $result) { 303 - $data = $result->getLastCommitData(); 304 - if ($data) { 305 - if ($data->getCommitDetail('authorPHID')) { 306 - $phids[$data->getCommitDetail('authorPHID')] = true; 307 - } 308 - } 309 - } 310 - 311 - $phids = array_keys($phids); 312 - $handles = $this->loadViewerHandles($phids); 313 - 314 301 $browse_table = id(new DiffusionBrowseTableView()) 315 302 ->setDiffusionRequest($drequest) 316 - ->setHandles($handles) 317 303 ->setPaths($results->getPaths()) 318 304 ->setUser($request->getUser()); 319 305
+1 -53
src/applications/diffusion/controller/DiffusionRepositoryController.php
··· 2 2 3 3 final class DiffusionRepositoryController extends DiffusionController { 4 4 5 - private $historyFuture; 6 5 private $browseFuture; 7 6 private $branchButton = null; 8 7 private $branchFuture; ··· 191 190 $path = $drequest->getPath(); 192 191 193 192 $futures = array(); 194 - $this->historyFuture = $this->callConduitMethod( 195 - 'diffusion.historyquery', 196 - array( 197 - 'commit' => $commit, 198 - 'path' => $path, 199 - 'offset' => 0, 200 - 'limit' => 15, 201 - )); 202 - $futures[] = $this->historyFuture; 203 193 204 194 $browse_pager = id(new PHUIPagerView()) 205 195 ->readFromRequest($request); ··· 230 220 // Just resolve all the futures before continuing. 231 221 } 232 222 233 - $phids = array(); 234 223 $content = array(); 235 224 236 225 try { 237 - $history_results = $this->historyFuture->resolve(); 238 - $history = DiffusionPathChange::newFromConduit( 239 - $history_results['pathChanges']); 240 - 241 - foreach ($history as $item) { 242 - $data = $item->getCommitData(); 243 - if ($data) { 244 - if ($data->getCommitDetail('authorPHID')) { 245 - $phids[$data->getCommitDetail('authorPHID')] = true; 246 - } 247 - if ($data->getCommitDetail('committerPHID')) { 248 - $phids[$data->getCommitDetail('committerPHID')] = true; 249 - } 250 - } 251 - } 252 - $history_exception = null; 253 - } catch (Exception $ex) { 254 - $history_results = null; 255 - $history = null; 256 - $history_exception = $ex; 257 - } 258 - 259 - try { 260 226 $browse_results = $this->browseFuture->resolve(); 261 227 $browse_results = DiffusionBrowseResultSet::newFromConduit( 262 228 $browse_results); ··· 264 230 $browse_paths = $browse_results->getPaths(); 265 231 $browse_paths = $browse_pager->sliceResults($browse_paths); 266 232 267 - foreach ($browse_paths as $item) { 268 - $data = $item->getLastCommitData(); 269 - if ($data) { 270 - if ($data->getCommitDetail('authorPHID')) { 271 - $phids[$data->getCommitDetail('authorPHID')] = true; 272 - } 273 - if ($data->getCommitDetail('committerPHID')) { 274 - $phids[$data->getCommitDetail('committerPHID')] = true; 275 - } 276 - } 277 - } 278 - 279 233 $browse_exception = null; 280 234 } catch (Exception $ex) { 281 235 $browse_results = null; 282 236 $browse_paths = null; 283 237 $browse_exception = $ex; 284 238 } 285 - 286 - $phids = array_keys($phids); 287 - $handles = $this->loadViewerHandles($phids); 288 239 289 240 if ($browse_results) { 290 241 $readme = $this->renderDirectoryReadme($browse_results); ··· 296 247 $browse_results, 297 248 $browse_paths, 298 249 $browse_exception, 299 - $handles, 300 250 $browse_pager); 301 251 302 252 if ($readme) { ··· 524 474 $browse_results, 525 475 $browse_paths, 526 476 $browse_exception, 527 - array $handles, 528 477 PHUIPagerView $pager) { 529 478 530 479 require_celerity_resource('diffusion-icons-css'); ··· 547 496 548 497 $browse_table = id(new DiffusionBrowseTableView()) 549 498 ->setUser($viewer) 550 - ->setDiffusionRequest($drequest) 551 - ->setHandles($handles); 499 + ->setDiffusionRequest($drequest); 552 500 if ($browse_paths) { 553 501 $browse_table->setPaths($browse_paths); 554 502 } else {
-8
src/applications/diffusion/view/DiffusionBrowseTableView.php
··· 3 3 final class DiffusionBrowseTableView extends DiffusionView { 4 4 5 5 private $paths; 6 - private $handles = array(); 7 6 8 7 public function setPaths(array $paths) { 9 8 assert_instances_of($paths, 'DiffusionRepositoryPath'); 10 9 $this->paths = $paths; 11 - return $this; 12 - } 13 - 14 - public function setHandles(array $handles) { 15 - assert_instances_of($handles, 'PhabricatorObjectHandle'); 16 - $this->handles = $handles; 17 10 return $this; 18 11 } 19 12 ··· 29 22 30 23 $need_pull = array(); 31 24 $rows = array(); 32 - $show_edit = false; 33 25 foreach ($this->paths as $path) { 34 26 $full_path = $base_path.$path->getPath(); 35 27