Skip to content

Commit ef3b625

Browse files
committed
Conpherence - improve durable column performance when sending updates
Summary: Ref T7708. We were generating things like the files widget when users sent a comment. This is unnecessary if we are in minimal display mode. This saves us fetching some data + rendering. Test Plan: sent messages successfully in durable column and full conpherence view Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7708 Differential Revision: https://secure.phabricator.com/D12760
1 parent f7c1473 commit ef3b625

File tree

1 file changed

+43
-38
lines changed

1 file changed

+43
-38
lines changed

src/applications/conpherence/controller/ConpherenceUpdateController.php

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ private function loadAndRenderUpdates(
453453
$conpherence_id,
454454
$latest_transaction_id) {
455455

456+
$minimal_display = $this->getRequest()->getExists('minimal_display');
456457
$need_widget_data = false;
457458
$need_transactions = false;
458459
$need_participant_cache = true;
@@ -464,7 +465,7 @@ private function loadAndRenderUpdates(
464465
case ConpherenceUpdateActions::MESSAGE:
465466
case ConpherenceUpdateActions::ADD_PERSON:
466467
$need_transactions = true;
467-
$need_widget_data = true;
468+
$need_widget_data = !$minimal_display;
468469
break;
469470
case ConpherenceUpdateActions::REMOVE_PERSON:
470471
case ConpherenceUpdateActions::NOTIFICATIONS:
@@ -488,7 +489,7 @@ private function loadAndRenderUpdates(
488489
$data = ConpherenceTransactionRenderer::renderTransactions(
489490
$user,
490491
$conpherence,
491-
!$this->getRequest()->getExists('minimal_display'));
492+
!$minimal_display);
492493
$participant_obj = $conpherence->getParticipant($user->getPHID());
493494
$participant_obj->markUpToDate($conpherence, $data['latest_transaction']);
494495
} else if ($need_transactions) {
@@ -505,51 +506,55 @@ private function loadAndRenderUpdates(
505506
$header = null;
506507
$people_widget = null;
507508
$file_widget = null;
508-
switch ($action) {
509-
case ConpherenceUpdateActions::METADATA:
510-
$policy_objects = id(new PhabricatorPolicyQuery())
511-
->setViewer($user)
512-
->setObject($conpherence)
513-
->execute();
514-
$header = $this->buildHeaderPaneContent($conpherence, $policy_objects);
515-
$nav_item = id(new ConpherenceThreadListView())
516-
->setUser($user)
517-
->setBaseURI($this->getApplicationURI())
518-
->renderSingleThread($conpherence);
519-
break;
520-
case ConpherenceUpdateActions::MESSAGE:
521-
$file_widget = id(new ConpherenceFileWidgetView())
522-
->setUser($this->getRequest()->getUser())
523-
->setConpherence($conpherence)
524-
->setUpdateURI($widget_uri);
525-
break;
526-
case ConpherenceUpdateActions::ADD_PERSON:
527-
$people_widget = id(new ConpherencePeopleWidgetView())
528-
->setUser($user)
529-
->setConpherence($conpherence)
530-
->setUpdateURI($widget_uri);
531-
break;
532-
case ConpherenceUpdateActions::REMOVE_PERSON:
533-
case ConpherenceUpdateActions::NOTIFICATIONS:
534-
default:
535-
break;
509+
if (!$minimal_display) {
510+
switch ($action) {
511+
case ConpherenceUpdateActions::METADATA:
512+
$policy_objects = id(new PhabricatorPolicyQuery())
513+
->setViewer($user)
514+
->setObject($conpherence)
515+
->execute();
516+
$header = $this->buildHeaderPaneContent(
517+
$conpherence,
518+
$policy_objects);
519+
$header = hsprintf('%s', $header);
520+
$nav_item = id(new ConpherenceThreadListView())
521+
->setUser($user)
522+
->setBaseURI($this->getApplicationURI())
523+
->renderSingleThread($conpherence);
524+
$nav_item = hsprintf('%s', $nav_item);
525+
break;
526+
case ConpherenceUpdateActions::MESSAGE:
527+
$file_widget = id(new ConpherenceFileWidgetView())
528+
->setUser($this->getRequest()->getUser())
529+
->setConpherence($conpherence)
530+
->setUpdateURI($widget_uri);
531+
$file_widget = $file_widget->render();
532+
break;
533+
case ConpherenceUpdateActions::ADD_PERSON:
534+
$people_widget = id(new ConpherencePeopleWidgetView())
535+
->setUser($user)
536+
->setConpherence($conpherence)
537+
->setUpdateURI($widget_uri);
538+
$people_widget = $people_widget->render();
539+
break;
540+
case ConpherenceUpdateActions::REMOVE_PERSON:
541+
case ConpherenceUpdateActions::NOTIFICATIONS:
542+
default:
543+
break;
544+
}
536545
}
537546

538-
$people_html = null;
539-
if ($people_widget) {
540-
$people_html = hsprintf('%s', $people_widget->render());
541-
}
542547
$data = $conpherence->getDisplayData($user);
543548
$content = array(
544549
'non_update' => $non_update,
545550
'transactions' => hsprintf('%s', $rendered_transactions),
546551
'conpherence_title' => (string) $data['title'],
547552
'latest_transaction_id' => $new_latest_transaction_id,
548-
'nav_item' => hsprintf('%s', $nav_item),
553+
'nav_item' => $nav_item,
549554
'conpherence_phid' => $conpherence->getPHID(),
550-
'header' => hsprintf('%s', $header),
551-
'file_widget' => $file_widget ? $file_widget->render() : null,
552-
'people_widget' => $people_html,
555+
'header' => $header,
556+
'file_widget' => $file_widget,
557+
'people_widget' => $people_widget,
553558
);
554559

555560
return $content;

0 commit comments

Comments
 (0)