mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01: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();
|
||||
|
||||
$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) {
|
||||
if ($transaction->shouldHide()) {
|
||||
continue;
|
||||
|
@ -134,6 +146,7 @@ final class ConpherenceViewController extends
|
|||
->setUser($user)
|
||||
->setConpherenceTransaction($transaction)
|
||||
->setHandles($handles)
|
||||
->setMarkupEngine($engine)
|
||||
->render();
|
||||
}
|
||||
$transactions = implode(' ', $rendered_transactions);
|
||||
|
|
|
@ -7,6 +7,12 @@ final class ConpherenceTransactionView extends AphrontView {
|
|||
|
||||
private $conpherenceTransaction;
|
||||
private $handles;
|
||||
private $markupEngine;
|
||||
|
||||
public function setMarkupEngine(PhabricatorMarkupEngine $markup_engine) {
|
||||
$this->markupEngine = $markup_engine;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||
|
@ -36,6 +42,7 @@ final class ConpherenceTransactionView extends AphrontView {
|
|||
->setContentSource($transaction->getContentSource());
|
||||
|
||||
$content_class = null;
|
||||
$content = null;
|
||||
switch ($transaction->getTransactionType()) {
|
||||
case ConpherenceTransactionType::TYPE_TITLE:
|
||||
case ConpherenceTransactionType::TYPE_PICTURE:
|
||||
|
@ -56,18 +63,9 @@ final class ConpherenceTransactionView extends AphrontView {
|
|||
PhabricatorMarkupEngine::extractFilePHIDsFromEmbeddedFiles(
|
||||
array($comment->getContent())
|
||||
);
|
||||
$markup_field = ConpherenceTransactionComment::MARKUP_FIELD_COMMENT;
|
||||
$engine = id(new PhabricatorMarkupEngine())
|
||||
->setViewer($this->getUser());
|
||||
$engine->addObject(
|
||||
$content = $this->markupEngine->getOutput(
|
||||
$comment,
|
||||
$markup_field
|
||||
);
|
||||
$engine->process();
|
||||
$content = $engine->getOutput(
|
||||
$comment,
|
||||
$markup_field
|
||||
);
|
||||
PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
|
||||
$content_class = 'conpherence-message phabricator-remarkup';
|
||||
$transaction_view
|
||||
->setImageURI($author->getImageURI())
|
||||
|
|
Loading…
Reference in a new issue