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

Improve handle batching behavior for commit list view

Summary: Ref T10978. Handle loads can be batched a bit more efficiently by doing them upfront.

Test Plan: Queries dropped a bit locally, but I mostly have the same autors/auditors. I'm seeing 286 queries on my account in production, so I'll check what happens with that.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10978

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

+25 -12
+25 -12
src/applications/audit/view/PhabricatorAuditListView.php
··· 83 83 $viewer = $this->getViewer(); 84 84 $rowc = array(); 85 85 86 - $handles = $viewer->loadHandles(mpull($this->commits, 'getPHID')); 86 + $phids = array(); 87 + foreach ($this->getCommits() as $commit) { 88 + $phids[] = $commit->getPHID(); 89 + 90 + foreach ($commit->getAudits() as $audit) { 91 + $phids[] = $audit->getAuditorPHID(); 92 + } 93 + 94 + $author_phid = $commit->getAuthorPHID(); 95 + if ($author_phid) { 96 + $phids[] = $author_phid; 97 + } 98 + } 99 + 100 + $handles = $viewer->loadHandles($phids); 87 101 88 102 $show_drafts = $this->getShowDrafts(); 89 103 ··· 106 120 $commit_desc = $this->getCommitDescription($commit_phid); 107 121 $committed = phabricator_datetime($commit->getEpoch(), $viewer); 108 122 109 - $audits = mpull($commit->getAudits(), null, 'getAuditorPHID'); 110 - $auditors = array(); 111 - foreach ($audits as $audit) { 112 - $auditor_phid = $audit->getAuditorPHID(); 113 - $auditors[$auditor_phid] = $viewer->renderHandle($auditor_phid); 114 - } 115 - $auditors = phutil_implode_html(', ', $auditors); 116 - 117 123 $status = $commit->getAuditStatus(); 118 124 119 125 $status_text = ··· 125 131 126 132 $author_phid = $commit->getAuthorPHID(); 127 133 if ($author_phid) { 128 - $author_name = $viewer->renderHandle($author_phid); 134 + $author_name = $handles[$author_phid]->renderLink(); 129 135 } else { 130 136 $author_name = $commit->getCommitData()->getAuthorName(); 131 137 } ··· 145 151 ->addAttribute(pht('Author: %s', $author_name)) 146 152 ->addIcon('none', $committed); 147 153 148 - if (!empty($auditors)) { 149 - $item->addByLine(pht('Auditors: %s', $auditors)); 154 + $audits = $commit->getAudits(); 155 + $auditor_phids = mpull($audits, 'getAuditorPHID'); 156 + if ($auditor_phids) { 157 + $item->addByLine( 158 + array( 159 + pht('Auditors:'), 160 + ' ', 161 + $handles->newSublist($auditor_phids)->renderList(), 162 + )); 150 163 } 151 164 152 165 if ($status_color) {