mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-10 19:38:34 +02:00
Batch Conpherence access to markup cache
Summary: Bulk process markup instead of doing them one at a time. Fixes T2504. Test Plan: Viewed service profile, saw a single call for all the cache entries. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2504 Differential Revision: https://secure.phabricator.com/D4844
This commit is contained in:
parent
68814d4eca
commit
5b39bbe71b
2 changed files with 22 additions and 11 deletions
|
@ -126,6 +126,18 @@ final class ConpherenceViewController extends
|
||||||
$rendered_transactions = array();
|
$rendered_transactions = array();
|
||||||
|
|
||||||
$transactions = $conpherence->getTransactions();
|
$transactions = $conpherence->getTransactions();
|
||||||
|
|
||||||
|
$engine = id(new PhabricatorMarkupEngine())
|
||||||
|
->setViewer($user);
|
||||||
|
foreach ($transactions as $transaction) {
|
||||||
|
if ($transaction->getComment()) {
|
||||||
|
$engine->addObject(
|
||||||
|
$transaction->getComment(),
|
||||||
|
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$engine->process();
|
||||||
|
|
||||||
foreach ($transactions as $transaction) {
|
foreach ($transactions as $transaction) {
|
||||||
if ($transaction->shouldHide()) {
|
if ($transaction->shouldHide()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -134,6 +146,7 @@ final class ConpherenceViewController extends
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setConpherenceTransaction($transaction)
|
->setConpherenceTransaction($transaction)
|
||||||
->setHandles($handles)
|
->setHandles($handles)
|
||||||
|
->setMarkupEngine($engine)
|
||||||
->render();
|
->render();
|
||||||
}
|
}
|
||||||
$transactions = implode(' ', $rendered_transactions);
|
$transactions = implode(' ', $rendered_transactions);
|
||||||
|
|
|
@ -7,6 +7,12 @@ final class ConpherenceTransactionView extends AphrontView {
|
||||||
|
|
||||||
private $conpherenceTransaction;
|
private $conpherenceTransaction;
|
||||||
private $handles;
|
private $handles;
|
||||||
|
private $markupEngine;
|
||||||
|
|
||||||
|
public function setMarkupEngine(PhabricatorMarkupEngine $markup_engine) {
|
||||||
|
$this->markupEngine = $markup_engine;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function setHandles(array $handles) {
|
public function setHandles(array $handles) {
|
||||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||||
|
@ -36,6 +42,7 @@ final class ConpherenceTransactionView extends AphrontView {
|
||||||
->setContentSource($transaction->getContentSource());
|
->setContentSource($transaction->getContentSource());
|
||||||
|
|
||||||
$content_class = null;
|
$content_class = null;
|
||||||
|
$content = null;
|
||||||
switch ($transaction->getTransactionType()) {
|
switch ($transaction->getTransactionType()) {
|
||||||
case ConpherenceTransactionType::TYPE_TITLE:
|
case ConpherenceTransactionType::TYPE_TITLE:
|
||||||
case ConpherenceTransactionType::TYPE_PICTURE:
|
case ConpherenceTransactionType::TYPE_PICTURE:
|
||||||
|
@ -56,18 +63,9 @@ final class ConpherenceTransactionView extends AphrontView {
|
||||||
PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
|
PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
|
||||||
array($comment->getContent())
|
array($comment->getContent())
|
||||||
);
|
);
|
||||||
$markup_field = ConpherenceTransactionComment::MARKUP_FIELD_COMMENT;
|
$content = $this->markupEngine->getOutput(
|
||||||
$engine = id(new PhabricatorMarkupEngine())
|
|
||||||
->setViewer($this->getUser());
|
|
||||||
$engine->addObject(
|
|
||||||
$comment,
|
$comment,
|
||||||
$markup_field
|
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||||
);
|
|
||||||
$engine->process();
|
|
||||||
$content = $engine->getOutput(
|
|
||||||
$comment,
|
|
||||||
$markup_field
|
|
||||||
);
|
|
||||||
$content_class = 'conpherence-message phabricator-remarkup';
|
$content_class = 'conpherence-message phabricator-remarkup';
|
||||||
$transaction_view
|
$transaction_view
|
||||||
->setImageURI($author->getImageURI())
|
->setImageURI($author->getImageURI())
|
||||||
|
|
Loading…
Add table
Reference in a new issue