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
This commit is contained in:
Bob Trahan 2015-05-07 16:01:41 -07:00
parent f7c14736c1
commit ef3b62564e

View file

@ -453,6 +453,7 @@ final class ConpherenceUpdateController
$conpherence_id, $conpherence_id,
$latest_transaction_id) { $latest_transaction_id) {
$minimal_display = $this->getRequest()->getExists('minimal_display');
$need_widget_data = false; $need_widget_data = false;
$need_transactions = false; $need_transactions = false;
$need_participant_cache = true; $need_participant_cache = true;
@ -464,7 +465,7 @@ final class ConpherenceUpdateController
case ConpherenceUpdateActions::MESSAGE: case ConpherenceUpdateActions::MESSAGE:
case ConpherenceUpdateActions::ADD_PERSON: case ConpherenceUpdateActions::ADD_PERSON:
$need_transactions = true; $need_transactions = true;
$need_widget_data = true; $need_widget_data = !$minimal_display;
break; break;
case ConpherenceUpdateActions::REMOVE_PERSON: case ConpherenceUpdateActions::REMOVE_PERSON:
case ConpherenceUpdateActions::NOTIFICATIONS: case ConpherenceUpdateActions::NOTIFICATIONS:
@ -488,7 +489,7 @@ final class ConpherenceUpdateController
$data = ConpherenceTransactionRenderer::renderTransactions( $data = ConpherenceTransactionRenderer::renderTransactions(
$user, $user,
$conpherence, $conpherence,
!$this->getRequest()->getExists('minimal_display')); !$minimal_display);
$participant_obj = $conpherence->getParticipant($user->getPHID()); $participant_obj = $conpherence->getParticipant($user->getPHID());
$participant_obj->markUpToDate($conpherence, $data['latest_transaction']); $participant_obj->markUpToDate($conpherence, $data['latest_transaction']);
} else if ($need_transactions) { } else if ($need_transactions) {
@ -505,51 +506,55 @@ final class ConpherenceUpdateController
$header = null; $header = null;
$people_widget = null; $people_widget = null;
$file_widget = null; $file_widget = null;
switch ($action) { if (!$minimal_display) {
case ConpherenceUpdateActions::METADATA: switch ($action) {
$policy_objects = id(new PhabricatorPolicyQuery()) case ConpherenceUpdateActions::METADATA:
->setViewer($user) $policy_objects = id(new PhabricatorPolicyQuery())
->setObject($conpherence) ->setViewer($user)
->execute(); ->setObject($conpherence)
$header = $this->buildHeaderPaneContent($conpherence, $policy_objects); ->execute();
$nav_item = id(new ConpherenceThreadListView()) $header = $this->buildHeaderPaneContent(
->setUser($user) $conpherence,
->setBaseURI($this->getApplicationURI()) $policy_objects);
->renderSingleThread($conpherence); $header = hsprintf('%s', $header);
break; $nav_item = id(new ConpherenceThreadListView())
case ConpherenceUpdateActions::MESSAGE: ->setUser($user)
$file_widget = id(new ConpherenceFileWidgetView()) ->setBaseURI($this->getApplicationURI())
->setUser($this->getRequest()->getUser()) ->renderSingleThread($conpherence);
->setConpherence($conpherence) $nav_item = hsprintf('%s', $nav_item);
->setUpdateURI($widget_uri); break;
break; case ConpherenceUpdateActions::MESSAGE:
case ConpherenceUpdateActions::ADD_PERSON: $file_widget = id(new ConpherenceFileWidgetView())
$people_widget = id(new ConpherencePeopleWidgetView()) ->setUser($this->getRequest()->getUser())
->setUser($user) ->setConpherence($conpherence)
->setConpherence($conpherence) ->setUpdateURI($widget_uri);
->setUpdateURI($widget_uri); $file_widget = $file_widget->render();
break; break;
case ConpherenceUpdateActions::REMOVE_PERSON: case ConpherenceUpdateActions::ADD_PERSON:
case ConpherenceUpdateActions::NOTIFICATIONS: $people_widget = id(new ConpherencePeopleWidgetView())
default: ->setUser($user)
break; ->setConpherence($conpherence)
->setUpdateURI($widget_uri);
$people_widget = $people_widget->render();
break;
case ConpherenceUpdateActions::REMOVE_PERSON:
case ConpherenceUpdateActions::NOTIFICATIONS:
default:
break;
}
} }
$people_html = null;
if ($people_widget) {
$people_html = hsprintf('%s', $people_widget->render());
}
$data = $conpherence->getDisplayData($user); $data = $conpherence->getDisplayData($user);
$content = array( $content = array(
'non_update' => $non_update, 'non_update' => $non_update,
'transactions' => hsprintf('%s', $rendered_transactions), 'transactions' => hsprintf('%s', $rendered_transactions),
'conpherence_title' => (string) $data['title'], 'conpherence_title' => (string) $data['title'],
'latest_transaction_id' => $new_latest_transaction_id, 'latest_transaction_id' => $new_latest_transaction_id,
'nav_item' => hsprintf('%s', $nav_item), 'nav_item' => $nav_item,
'conpherence_phid' => $conpherence->getPHID(), 'conpherence_phid' => $conpherence->getPHID(),
'header' => hsprintf('%s', $header), 'header' => $header,
'file_widget' => $file_widget ? $file_widget->render() : null, 'file_widget' => $file_widget,
'people_widget' => $people_html, 'people_widget' => $people_widget,
); );
return $content; return $content;