1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-30 10:42:41 +01:00

Set viewer for all handles loaded in controllers

Summary:
I've replaced all `id(new PhabricatorObjectHandleData(...))->loadHandles()` by `$this->loadViewerHandles(...)`.
Lint caught one usage in a static method.

Test Plan: Displayed revision with sporadic author.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3432
This commit is contained in:
vrana 2012-09-04 19:02:56 -07:00
parent efd59322f2
commit 8ff52c0b6c
65 changed files with 91 additions and 139 deletions

View file

@ -54,7 +54,7 @@ final class PhabricatorAuditAddCommentController
->addCCs($ccs) ->addCCs($ccs)
->addComment($comment); ->addComment($comment);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$uri = $handles[$commit_phid]->getURI(); $uri = $handles[$commit_phid]->getURI();
$draft = id(new PhabricatorDraft())->loadOneWhere( $draft = id(new PhabricatorDraft())->loadOneWhere(

View file

@ -228,7 +228,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
} }
$phids = array($phid); $phids = array($phid);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$handle = $handles[$phid]; $handle = $handles[$phid];
$this->validateHandle($handle); $this->validateHandle($handle);
@ -393,7 +393,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
$view->setNoDataString($nodata); $view->setNoDataString($nodata);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
@ -485,7 +485,7 @@ final class PhabricatorAuditListController extends PhabricatorAuditController {
$view->setNoDataString($nodata); $view->setNoDataString($nodata);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();

View file

@ -68,7 +68,7 @@ final class PhabricatorAuditPreviewController
$phids = array_merge($phids, $view->getRequiredHandlePHIDs()); $phids = array_merge($phids, $view->getRequiredHandlePHIDs());
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
id(new PhabricatorDraft()) id(new PhabricatorDraft())

View file

@ -217,10 +217,14 @@ abstract class PhabricatorController extends AphrontController {
protected function loadHandles(array $phids) { protected function loadHandles(array $phids) {
$phids = array_filter($phids); $phids = array_filter($phids);
$this->handles = id(new PhabricatorObjectHandleData($phids)) $this->handles = $this->loadViewerHandles($phids);
return $this;
}
protected function loadViewerHandles(array $phids) {
return id(new PhabricatorObjectHandleData($phids))
->setViewer($this->getRequest()->getUser()) ->setViewer($this->getRequest()->getUser())
->loadHandles(); ->loadHandles();
return $this;
} }
protected function renderHandlesForPHIDs(array $phids) { protected function renderHandlesForPHIDs(array $phids) {

View file

@ -43,7 +43,7 @@ final class PhabricatorCalendarBrowseController
$month_view->setHolidays($holidays); $month_view->setHolidays($holidays);
$phids = mpull($statuses, 'getUserPHID'); $phids = mpull($statuses, 'getUserPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
foreach ($statuses as $status) { foreach ($statuses as $status) {
$event = new AphrontCalendarEventView(); $event = new AphrontCalendarEventView();

View file

@ -36,7 +36,7 @@ final class PhabricatorCountdownListController
$timers = $pager->sliceResults($timers); $timers = $pager->sliceResults($timers);
$phids = mpull($timers, 'getAuthorPHID'); $phids = mpull($timers, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($timers as $timer) { foreach ($timers as $timer) {

View file

@ -203,8 +203,7 @@ final class DifferentialChangesetViewController extends DifferentialController {
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$parser->setHandles($handles); $parser->setHandles($handles);
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();

View file

@ -59,9 +59,7 @@ final class DifferentialCommentPreviewController
$handles = array_merge($handles, $ccs); $handles = array_merge($handles, $ccs);
} }
$handles = id(new PhabricatorObjectHandleData($handles)) $handles = $this->loadViewerHandles($handles);
->setViewer($request->getUser())
->loadHandles();
$view = new DifferentialRevisionCommentView(); $view = new DifferentialRevisionCommentView();
$view->setUser($request->getUser()); $view->setUser($request->getUser());

View file

@ -92,8 +92,7 @@ final class DifferentialRevisionEditController extends DifferentialController {
} }
$phids = array_mergev($aux_phids); $phids = array_mergev($aux_phids);
$phids = array_unique($phids); $phids = array_unique($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
foreach ($aux_fields as $key => $aux_field) { foreach ($aux_fields as $key => $aux_field) {
$aux_field->setHandles(array_select_keys($handles, $aux_phids[$key])); $aux_field->setHandles(array_select_keys($handles, $aux_phids[$key]));
} }

View file

@ -172,9 +172,7 @@ final class DifferentialRevisionListController extends DifferentialController {
} }
$phids = array_mergev(mpull($view_objects, 'getRequiredHandlePHIDs')); $phids = array_mergev(mpull($view_objects, 'getRequiredHandlePHIDs'));
$phids[] = $params['phid']; $phids[] = $params['phid'];
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->setViewer($this->getRequest()->getUser())
->loadHandles();
foreach ($views as $view) { foreach ($views as $view) {
if (empty($view['special'])) { if (empty($view['special'])) {

View file

@ -125,8 +125,7 @@ final class DifferentialRevisionStatsController extends DifferentialController {
DifferentialAction::ACTION_CLOSE); DifferentialAction::ACTION_CLOSE);
$panels = array(); $panels = array();
$handles = id(new PhabricatorObjectHandleData(array($params['phid']))) $handles = $this->loadViewerHandles(array($params['phid']));
->loadHandles();
$filter_form = id(new AphrontFormView()) $filter_form = id(new AphrontFormView())
->setAction('/differential/stats/'.$this->filter.'/') ->setAction('/differential/stats/'.$this->filter.'/')

View file

@ -144,9 +144,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
$object_phids = array_merge($object_phids, array_mergev($aux_phids)); $object_phids = array_merge($object_phids, array_mergev($aux_phids));
$object_phids = array_unique($object_phids); $object_phids = array_unique($object_phids);
$handles = id(new PhabricatorObjectHandleData($object_phids)) $handles = $this->loadViewerHandles($object_phids);
->setViewer($this->getRequest()->getUser())
->loadHandles();
foreach ($aux_fields as $key => $aux_field) { foreach ($aux_fields as $key => $aux_field) {
// Make sure each field only has access to handles it specifically // Make sure each field only has access to handles it specifically
@ -883,9 +881,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
->loadAssets(); ->loadAssets();
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->setViewer($this->getRequest()->getUser())
->loadHandles();
$view->setHandles($handles); $view->setHandles($handles);
return return

View file

@ -79,7 +79,7 @@ final class DiffusionBrowseController extends DiffusionController {
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$browse_table = new DiffusionBrowseTableView(); $browse_table = new DiffusionBrowseTableView();
$browse_table->setDiffusionRequest($drequest); $browse_table->setDiffusionRequest($drequest);

View file

@ -361,8 +361,7 @@ final class DiffusionCommitController extends DiffusionController {
$handles = array(); $handles = array();
if ($phids) { if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
} }
$props = array(); $props = array();
@ -469,7 +468,7 @@ final class DiffusionCommitController extends DiffusionController {
$view->setShowDescriptions(false); $view->setShowDescriptions(false);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$view->setAuthorityPHIDs($this->auditAuthorityPHIDs); $view->setAuthorityPHIDs($this->auditAuthorityPHIDs);
$this->highlightedAudits = $view->getHighlightedAudits(); $this->highlightedAudits = $view->getHighlightedAudits();
@ -509,7 +508,7 @@ final class DiffusionCommitController extends DiffusionController {
$view->setPathMap($path_map); $view->setPathMap($path_map);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
return $view; return $view;
@ -757,7 +756,7 @@ final class DiffusionCommitController extends DiffusionController {
$history_table->loadRevisions(); $history_table->loadRevisions();
$phids = $history_table->getRequiredHandlePHIDs(); $phids = $history_table->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$history_table->setHandles($handles); $history_table->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();

View file

@ -42,8 +42,7 @@ final class DiffusionCommitEditController extends DiffusionController {
$commit_phid, $commit_phid,
$edge_type $edge_type
); );
$handles = id(new PhabricatorObjectHandleData($current_proj_phids)) $handles = $this->loadViewerHandles($current_proj_phids);
->loadHandles();
$proj_t_values = mpull($handles, 'getFullName', 'getPHID'); $proj_t_values = mpull($handles, 'getFullName', 'getPHID');
if ($request->isFormPost()) { if ($request->isFormPost()) {

View file

@ -141,7 +141,7 @@ abstract class DiffusionController extends PhabricatorController {
->loadAssets(); ->loadAssets();
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();

View file

@ -94,7 +94,7 @@ final class DiffusionDiffController extends DiffusionController {
} }
$phids = mpull($inlines, 'getAuthorPHID'); $phids = mpull($inlines, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$parser->setHandles($handles); $parser->setHandles($handles);
} }

View file

@ -84,7 +84,7 @@ final class DiffusionHistoryController extends DiffusionController {
$history_table->loadRevisions(); $history_table->loadRevisions();
$phids = $history_table->getRequiredHandlePHIDs(); $phids = $history_table->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$history_table->setHandles($handles); $history_table->setHandles($handles);
if ($show_graph) { if ($show_graph) {

View file

@ -37,7 +37,7 @@ final class DiffusionLastModifiedController extends DiffusionController {
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$output = DiffusionBrowseTableView::renderLastModifiedColumns( $output = DiffusionBrowseTableView::renderLastModifiedColumns(
$drequest->getRepository(), $drequest->getRepository(),

View file

@ -64,7 +64,7 @@ final class DiffusionRepositoryController extends DiffusionController {
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$history_table = new DiffusionHistoryTableView(); $history_table = new DiffusionHistoryTableView();
$history_table->setDiffusionRequest($drequest); $history_table->setDiffusionRequest($drequest);
@ -240,7 +240,7 @@ final class DiffusionRepositoryController extends DiffusionController {
$view->setCommits($commits); $view->setCommits($commits);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();

View file

@ -72,7 +72,7 @@ final class DiffusionTagListController extends DiffusionController {
->setDiffusionRequest($drequest); ->setDiffusionRequest($drequest);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = id(new AphrontPanelView()) $panel = id(new AphrontPanelView())

View file

@ -332,7 +332,7 @@ final class PhabricatorDirectoryMainController
$phids = array_merge( $phids = array_merge(
array($user_phid), array($user_phid),
$revision_view->getRequiredHandlePHIDs()); $revision_view->getRequiredHandlePHIDs());
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$revision_view->setHandles($handles); $revision_view->setHandles($handles);
@ -385,7 +385,7 @@ final class PhabricatorDirectoryMainController
array_filter(mpull($tasks, 'getOwnerPHID')), array_filter(mpull($tasks, 'getOwnerPHID')),
array_mergev(mpull($tasks, 'getProjectPHIDs'))); array_mergev(mpull($tasks, 'getProjectPHIDs')));
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view = new ManiphestTaskListView(); $view = new ManiphestTaskListView();
$view->setTasks($tasks); $view->setTasks($tasks);
@ -623,7 +623,7 @@ final class PhabricatorDirectoryMainController
$view->setUser($user); $view->setUser($user);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
@ -667,7 +667,7 @@ final class PhabricatorDirectoryMainController
$view->setUser($user); $view->setUser($user);
$phids = $view->getRequiredHandlePHIDs(); $phids = $view->getRequiredHandlePHIDs();
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$view->setHandles($handles); $view->setHandles($handles);
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();

View file

@ -34,7 +34,7 @@ final class DrydockLeaseListController extends DrydockController {
$data = $pager->sliceResults($data); $data = $pager->sliceResults($data);
$phids = mpull($data, 'getOwnerPHID'); $phids = mpull($data, 'getOwnerPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$resource_ids = mpull($data, 'getResourceID'); $resource_ids = mpull($data, 'getResourceID');
$resources = array(); $resources = array();

View file

@ -34,7 +34,7 @@ final class DrydockResourceListController extends DrydockController {
$data = $pager->sliceResults($data); $data = $pager->sliceResults($data);
$phids = mpull($data, 'getOwnerPHID'); $phids = mpull($data, 'getOwnerPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($data as $resource) { foreach ($data as $resource) {

View file

@ -209,7 +209,7 @@ final class PhabricatorFileListController extends PhabricatorFileController {
$this->setListPager($pager); $this->setListPager($pager);
$phids = mpull($files, 'getAuthorPHID'); $phids = mpull($files, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$highlighted = $request->getStr('h'); $highlighted = $request->getStr('h');
$highlighted = explode('-', $highlighted); $highlighted = explode('-', $highlighted);

View file

@ -57,8 +57,7 @@ final class PhabricatorFileMacroListController
"phid IN (%Ls)", "phid IN (%Ls)",
$file_phids); $file_phids);
$author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); $author_phids = mpull($files, 'getAuthorPHID', 'getPHID');
$handles = id(new PhabricatorObjectHandleData($author_phids)) $handles = $this->loadViewerHandles($author_phids);
->loadHandles();
} }
$files_map = mpull($files, null, 'getPHID'); $files_map = mpull($files, null, 'getPHID');

View file

@ -96,8 +96,7 @@ final class HeraldHomeController extends HeraldController {
$rules = $query->executeWithOffsetPager($pager); $rules = $query->executeWithOffsetPager($pager);
$need_phids = mpull($rules, 'getAuthorPHID'); $need_phids = mpull($rules, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($need_phids)) $handles = $this->loadViewerHandles($need_phids);
->loadHandles();
$list_view = id(new HeraldRuleListView()) $list_view = id(new HeraldRuleListView())
->setRules($rules) ->setRules($rules)

View file

@ -474,7 +474,7 @@ final class HeraldRuleController extends HeraldController {
$phids[] = $rule->getAuthorPHID(); $phids[] = $rule->getAuthorPHID();
return id(new PhabricatorObjectHandleData($phids))->loadHandles(); return $this->loadViewerHandles($phids);
} }

View file

@ -39,8 +39,7 @@ final class HeraldRuleEditHistoryController extends HeraldController {
$edits = $edit_query->executeWithOffsetPager($pager); $edits = $edit_query->executeWithOffsetPager($pager);
$need_phids = mpull($edits, 'getEditorPHID'); $need_phids = mpull($edits, 'getEditorPHID');
$handles = id(new PhabricatorObjectHandleData($need_phids)) $handles = $this->loadViewerHandles($need_phids);
->loadHandles();
$list_view = id(new HeraldRuleEditHistoryView()) $list_view = id(new HeraldRuleEditHistoryView())
->setEdits($edits) ->setEdits($edits)

View file

@ -61,8 +61,7 @@ final class HeraldTranscriptController extends HeraldController {
$phids = array_unique($phids); $phids = array_unique($phids);
$phids = array_filter($phids); $phids = array_filter($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$this->handles = $handles; $this->handles = $handles;
if ($xscript->getDryRun()) { if ($xscript->getDryRun()) {
@ -473,8 +472,7 @@ final class HeraldTranscriptController extends HeraldController {
$data = array(); $data = array();
if ($object_xscript) { if ($object_xscript) {
$phid = $object_xscript->getPHID(); $phid = $object_xscript->getPHID();
$handles = id(new PhabricatorObjectHandleData(array($phid))) $handles = $this->loadViewerHandles(array($phid));
->loadHandles();
$data += array( $data += array(
'Object Name' => $object_xscript->getName(), 'Object Name' => $object_xscript->getName(),

View file

@ -63,8 +63,7 @@ final class HeraldTranscriptListController extends HeraldController {
$handles = array(); $handles = array();
if ($data) { if ($data) {
$phids = ipull($data, 'objectPHID', 'objectPHID'); $phids = ipull($data, 'objectPHID', 'objectPHID');
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
} }
$rows = array(); $rows = array();

View file

@ -55,8 +55,7 @@ final class ManiphestBatchEditController extends ManiphestController {
$panel->setHeader('Maniphest Batch Editor'); $panel->setHeader('Maniphest Batch Editor');
$handle_phids = mpull($tasks, 'getOwnerPHID'); $handle_phids = mpull($tasks, 'getOwnerPHID');
$handles = id(new PhabricatorObjectHandleData($handle_phids)) $handles = $this->loadViewerHandles($handle_phids);
->loadHandles();
$list = new ManiphestTaskListView(); $list = new ManiphestTaskListView();
$list->setTasks($tasks); $list->setTasks($tasks);

View file

@ -90,8 +90,7 @@ final class ManiphestExportController extends ManiphestController {
$tasks = array_mergev($tasks); $tasks = array_mergev($tasks);
$all_projects = array_mergev(mpull($tasks, 'getProjectPHIDs')); $all_projects = array_mergev(mpull($tasks, 'getProjectPHIDs'));
$project_handles = id(new PhabricatorObjectHandleData($all_projects)) $project_handles = $this->loadViewerHandles($all_projects);
->loadHandles();
$handles += $project_handles; $handles += $project_handles;
$workbook = new PHPExcel(); $workbook = new PHPExcel();

View file

@ -92,7 +92,7 @@ final class ManiphestReportController extends ManiphestController {
$project_phid = $request->getStr('project'); $project_phid = $request->getStr('project');
if ($project_phid) { if ($project_phid) {
$phids = array($project_phid); $phids = array($project_phid);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$handle = $handles[$project_phid]; $handle = $handles[$project_phid];
} }
@ -403,7 +403,7 @@ final class ManiphestReportController extends ManiphestController {
$project_handle = null; $project_handle = null;
if ($project_phid) { if ($project_phid) {
$phids = array($project_phid); $phids = array($project_phid);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$project_handle = $handles[$project_phid]; $project_handle = $handles[$project_phid];
$query->withProjects($phids); $query->withProjects($phids);
@ -475,7 +475,7 @@ final class ManiphestReportController extends ManiphestController {
} }
$phids = array_keys($result); $phids = array_keys($result);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$handles = msort($handles, 'getName'); $handles = msort($handles, 'getName');
$order = $request->getStr('order', 'name'); $order = $request->getStr('order', 'name');

View file

@ -61,7 +61,7 @@ final class ManiphestTaskDescriptionChangeController
$phids[$phid] = $phid; $phids[$phid] = $phid;
} }
} }
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$engine = new PhabricatorMarkupEngine(); $engine = new PhabricatorMarkupEngine();
$engine->addObject($transaction, ManiphestTransaction::MARKUP_FIELD_BODY); $engine->addObject($transaction, ManiphestTransaction::MARKUP_FIELD_BODY);

View file

@ -105,8 +105,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$dict = array(); $dict = array();
$dict['Status'] = $dict['Status'] =

View file

@ -318,8 +318,7 @@ final class ManiphestTaskEditController extends ManiphestController {
$phids = array_filter($phids); $phids = array_filter($phids);
$phids = array_unique($phids); $phids = array_unique($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$tvalues = mpull($handles, 'getFullName', 'getPHID'); $tvalues = mpull($handles, 'getFullName', 'getPHID');

View file

@ -113,8 +113,7 @@ final class ManiphestTransactionPreviewController extends ManiphestController {
} }
$phids[] = $user->getPHID(); $phids[] = $user->getPHID();
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$transactions = array(); $transactions = array();
$transactions[] = $transaction; $transactions[] = $transaction;

View file

@ -49,8 +49,7 @@ final class PhabricatorMetaMTAReceiveController
$received->processReceivedMail(); $received->processReceivedMail();
$phid = $receiver->getPHID(); $phid = $receiver->getPHID();
$handles = id(new PhabricatorObjectHandleData(array($phid))) $handles = $this->loadViewerHandles(array($phid));
->loadHandles();
$uri = $handles[$phid]->getURI(); $uri = $handles[$phid]->getURI();
return id(new AphrontRedirectResponse())->setURI($uri); return id(new AphrontRedirectResponse())->setURI($uri);

View file

@ -40,7 +40,7 @@ final class PhabricatorMetaMTAReceivedListController
); );
$phids = array_unique(array_filter($phids)); $phids = array_unique(array_filter($phids));
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($mails as $mail) { foreach ($mails as $mail) {

View file

@ -59,9 +59,7 @@ final class PhabricatorOwnersDetailController
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->setViewer($this->getRequest()->getUser())
->loadHandles();
$rows = array(); $rows = array();
@ -216,9 +214,7 @@ final class PhabricatorOwnersDetailController
$phids[] = $commit_view['view']->getRequiredHandlePHIDs(); $phids[] = $commit_view['view']->getRequiredHandlePHIDs();
} }
$phids = array_mergev($phids); $phids = array_mergev($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->setViewer($user)
->loadHandles();
$commit_panels = array(); $commit_panels = array();
foreach ($commit_views as $commit_view) { foreach ($commit_views as $commit_view) {

View file

@ -129,8 +129,7 @@ final class PhabricatorOwnersEditController
$error_view->setErrors($errors); $error_view->setErrors($errors);
} }
$handles = id(new PhabricatorObjectHandleData($owners)) $handles = $this->loadViewerHandles($owners);
->loadHandles();
$primary = $package->getPrimaryOwnerPHID(); $primary = $package->getPrimaryOwnerPHID();
if ($primary && isset($handles[$primary])) { if ($primary && isset($handles[$primary])) {

View file

@ -145,8 +145,7 @@ final class PhabricatorOwnersListController
if ($request->getArr('owner')) { if ($request->getArr('owner')) {
$phids = $request->getArr('owner'); $phids = $request->getArr('owner');
$phid = reset($phids); $phid = reset($phids);
$handles = id(new PhabricatorObjectHandleData(array($phid))) $handles = $this->loadViewerHandles(array($phid));
->loadHandles();
$owners_search_value = array( $owners_search_value = array(
$phid => $handles[$phid]->getFullName(), $phid => $handles[$phid]->getFullName(),
); );
@ -222,9 +221,7 @@ final class PhabricatorOwnersListController
$phids[$owner->getUserPHID()] = true; $phids[$owner->getUserPHID()] = true;
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->setViewer($this->getRequest()->getUser())
->loadHandles();
$repository_phids = array(); $repository_phids = array();
foreach ($paths as $path) { foreach ($paths as $path) {

View file

@ -39,7 +39,7 @@ final class PhabricatorPeopleLogsController
$phids = array_merge($filter_user, $filter_actor); $phids = array_merge($filter_user, $filter_actor);
if ($phids) { if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
if ($filter_user) { if ($filter_user) {
$filter_user = reset($filter_user); $filter_user = reset($filter_user);
$user_value = array( $user_value = array(
@ -165,7 +165,7 @@ final class PhabricatorPeopleLogsController
$phids[$log->getUserPHID()] = true; $phids[$log->getUserPHID()] = true;
} }
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($logs as $log) { foreach ($logs as $log) {

View file

@ -84,8 +84,7 @@ final class PhameBlogViewController
$blogger_phids = $this->getBloggerPHIDs(); $blogger_phids = $this->getBloggerPHIDs();
if ($blogger_phids) { if ($blogger_phids) {
$bloggers = id(new PhabricatorObjectHandleData($blogger_phids)) $bloggers = $this->loadViewerHandles($blogger_phids);
->loadHandles();
} else { } else {
$bloggers = array(); $bloggers = array();
} }

View file

@ -67,7 +67,7 @@ abstract class PhamePostListBaseController
$blogger_phids = mpull($posts, 'getBloggerPHID', 'getBloggerPHID'); $blogger_phids = mpull($posts, 'getBloggerPHID', 'getBloggerPHID');
return return
id(new PhabricatorObjectHandleData($blogger_phids))->loadHandles(); $this->loadViewerHandles($blogger_phids);
} }
protected function buildPostListPageResponse() { protected function buildPostListPageResponse() {

View file

@ -24,8 +24,7 @@ final class PhabricatorPHIDLookupController
$request = $this->getRequest(); $request = $this->getRequest();
$phids = $request->getStrList('phids'); $phids = $request->getStrList('phids');
if ($phids) { if ($phids) {
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$rows = array(); $rows = array();
foreach ($handles as $handle) { foreach ($handles as $handle) {

View file

@ -238,7 +238,7 @@ final class PhrictionDiffController
$user = $this->getRequest()->getUser(); $user = $this->getRequest()->getUser();
$phids = mpull($content, 'getAuthorPHID'); $phids = mpull($content, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($content as $c) { foreach ($content as $c) {

View file

@ -125,7 +125,7 @@ final class PhrictionDocumentController
$content->getAuthorPHID(), $content->getAuthorPHID(),
$project_phid, $project_phid,
)); ));
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$age = time() - $content->getDateCreated(); $age = time() - $content->getDateCreated();
$age = floor($age / (60 * 60 * 24)); $age = floor($age / (60 * 60 * 24));
@ -234,8 +234,7 @@ final class PhrictionDocumentController
$ancestor_phids = mpull($ancestors, 'getPHID'); $ancestor_phids = mpull($ancestors, 'getPHID');
$handles = array(); $handles = array();
if ($ancestor_phids) { if ($ancestor_phids) {
$handles = id(new PhabricatorObjectHandleData($ancestor_phids)) $handles = $this->loadViewerHandles($ancestor_phids);
->loadHandles();
} }
$ancestor_handles = array(); $ancestor_handles = array();

View file

@ -55,8 +55,7 @@ final class PhrictionHistoryController
$history = $pager->sliceResults($history); $history = $pager->sliceResults($history);
$author_phids = mpull($history, 'getAuthorPHID'); $author_phids = mpull($history, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($author_phids)) $handles = $this->loadViewerHandles($author_phids);
->loadHandles();
$rows = array(); $rows = array();
foreach ($history as $content) { foreach ($history as $content) {

View file

@ -65,7 +65,7 @@ final class PhrictionListController
$content = mpull($documents, 'getContent'); $content = mpull($documents, 'getContent');
$phids = mpull($content, 'getAuthorPHID'); $phids = mpull($content, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();

View file

@ -32,8 +32,7 @@ final class PonderAnswerPreviewController
$author_phid = $user->getPHID(); $author_phid = $user->getPHID();
$object_phids = array($author_phid); $object_phids = array($author_phid);
$handles = id(new PhabricatorObjectHandleData($object_phids)) $handles = $this->loadViewerHandles($object_phids);
->loadHandles();
$answer = new PonderAnswer(); $answer = new PonderAnswer();
$answer->setContent($request->getStr('content')); $answer->setContent($request->getStr('content'));

View file

@ -86,8 +86,7 @@ final class PonderFeedController extends PonderController {
foreach ($data as $question) { foreach ($data as $question) {
$phids[] = $question->getAuthorPHID(); $phids[] = $question->getAuthorPHID();
} }
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$side_nav->appendChild( $side_nav->appendChild(
id(new PonderQuestionFeedView()) id(new PonderQuestionFeedView())
@ -115,8 +114,7 @@ final class PonderFeedController extends PonderController {
); );
$phids = array($user->getPHID()); $phids = array($user->getPHID());
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$side_nav->appendChild( $side_nav->appendChild(
id(new PonderUserProfileView()) id(new PonderUserProfileView())

View file

@ -29,8 +29,7 @@ final class PonderQuestionPreviewController
$author_phid = $user->getPHID(); $author_phid = $user->getPHID();
$object_phids = array($author_phid); $object_phids = array($author_phid);
$handles = id(new PhabricatorObjectHandleData($object_phids)) $handles = $this->loadViewerHandles($object_phids);
->loadHandles();
$question = new PonderQuestion(); $question = new PonderQuestion();
$question->setContent($request->getStr('content')); $question->setContent($request->getStr('content'));

View file

@ -41,8 +41,7 @@ final class PonderQuestionViewController extends PonderController {
$object_phids[] = $answer->getAuthorPHID(); $object_phids[] = $answer->getAuthorPHID();
} }
$handles = id(new PhabricatorObjectHandleData($object_phids)) $handles = $this->loadViewerHandles($object_phids);
->loadHandles();
$detail_panel = new PonderQuestionDetailView(); $detail_panel = new PonderQuestionDetailView();
$detail_panel $detail_panel

View file

@ -87,8 +87,7 @@ final class PhabricatorProjectMembersEditController
} }
$member_phids = array_reverse($member_phids); $member_phids = array_reverse($member_phids);
$handles = id(new PhabricatorObjectHandleData($member_phids)) $handles = $this->loadViewerHandles($member_phids);
->loadHandles();
$state = array(); $state = array();
foreach ($handles as $handle) { foreach ($handles as $handle) {

View file

@ -149,8 +149,7 @@ final class PhabricatorProjectProfileController
$phids = array($project->getAuthorPHID()); $phids = array($project->getAuthorPHID());
$phids = array_unique($phids); $phids = array_unique($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$timestamp = phabricator_datetime($project->getDateCreated(), $viewer); $timestamp = phabricator_datetime($project->getDateCreated(), $viewer);
@ -187,8 +186,7 @@ final class PhabricatorProjectProfileController
PhabricatorProjectProfile $profile) { PhabricatorProjectProfile $profile) {
$member_phids = $project->getMemberPHIDs(); $member_phids = $project->getMemberPHIDs();
$handles = id(new PhabricatorObjectHandleData($member_phids)) $handles = $this->loadViewerHandles($member_phids);
->loadHandles();
$affiliated = array(); $affiliated = array();
foreach ($handles as $phids => $handle) { foreach ($handles as $phids => $handle) {
@ -259,8 +257,7 @@ final class PhabricatorProjectProfileController
$phids = mpull($tasks, 'getOwnerPHID'); $phids = mpull($tasks, 'getOwnerPHID');
$phids = array_filter($phids); $phids = array_filter($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$task_views = array(); $task_views = array();
foreach ($tasks as $task) { foreach ($tasks as $task) {

View file

@ -109,8 +109,7 @@ final class PhabricatorSearchAttachController
$strings = $this->getStrings(); $strings = $this->getStrings();
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$obj_dialog = new PhabricatorObjectSelectorDialog(); $obj_dialog = new PhabricatorObjectSelectorDialog();
$obj_dialog $obj_dialog
@ -279,8 +278,7 @@ final class PhabricatorSearchAttachController
private function raiseGraphCycleException(PhabricatorEdgeCycleException $ex) { private function raiseGraphCycleException(PhabricatorEdgeCycleException $ex) {
$cycle = $ex->getCycle(); $cycle = $ex->getCycle();
$handles = id(new PhabricatorObjectHandleData($cycle)) $handles = $this->loadViewerHandles($cycle);
->loadHandles();
$names = array(); $names = array();
foreach ($cycle as $cycle_phid) { foreach ($cycle as $cycle_phid) {
$names[] = $handles[$cycle_phid]->getFullName(); $names[] = $handles[$cycle_phid]->getFullName();

View file

@ -128,8 +128,7 @@ final class PhabricatorSearchController
$query->getParameter('project', array()) $query->getParameter('project', array())
); );
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$author_value = array_select_keys( $author_value = array_select_keys(
$handles, $handles,

View file

@ -103,7 +103,7 @@ final class PhabricatorSearchIndexController
$relationships = $document->getRelationshipData(); $relationships = $document->getRelationshipData();
$phids = ipull($relationships, 1); $phids = ipull($relationships, 1);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($relationships as $relationship) { foreach ($relationships as $relationship) {

View file

@ -64,8 +64,7 @@ final class PhabricatorSearchSelectController
$phids += $this->queryObjectNames($query_str); $phids += $this->queryObjectNames($query_str);
$phids = array_keys($phids); $phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$data = array(); $data = array();
foreach ($handles as $handle) { foreach ($handles as $handle) {

View file

@ -56,7 +56,7 @@ final class PhabricatorSlowvoteListController
$polls = $this->loadPolls($pager, $view); $polls = $this->loadPolls($pager, $view);
$phids = mpull($polls, 'getAuthorPHID'); $phids = mpull($polls, 'getAuthorPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
$rows = array(); $rows = array();
foreach ($polls as $poll) { foreach ($polls as $poll) {

View file

@ -170,7 +170,7 @@ final class PhabricatorTypeaheadCommonDatasourceController
if ($need_rich_data) { if ($need_rich_data) {
$phids = mpull($users, 'getPHID'); $phids = mpull($users, 'getPHID');
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); $handles = $this->loadViewerHandles($phids);
} }
foreach ($users as $user) { foreach ($users as $user) {

View file

@ -226,8 +226,7 @@ abstract class PhabricatorInlineCommentController
$phids = array($user->getPHID()); $phids = array($user->getPHID());
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$view = new DifferentialInlineCommentView(); $view = new DifferentialInlineCommentView();
$view->setInlineComment($inline); $view->setInlineComment($inline);

View file

@ -30,8 +30,7 @@ abstract class PhabricatorInlineCommentPreviewController
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
$phids = array($user->getPHID()); $phids = array($user->getPHID());
$handles = id(new PhabricatorObjectHandleData($phids)) $handles = $this->loadViewerHandles($phids);
->loadHandles();
$views = array(); $views = array();
foreach ($inlines as $inline) { foreach ($inlines as $inline) {