Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/query/ConpherenceThreadQuery.php
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | protected function loadPage() { | ||||
$conpherences = $table->loadAllFromArray($data); | $conpherences = $table->loadAllFromArray($data); | ||||
if ($conpherences) { | if ($conpherences) { | ||||
$conpherences = mpull($conpherences, null, 'getPHID'); | $conpherences = mpull($conpherences, null, 'getPHID'); | ||||
$this->loadParticipantsAndInitHandles($conpherences); | $this->loadParticipantsAndInitHandles($conpherences); | ||||
if ($this->needParticipantCache) { | if ($this->needParticipantCache) { | ||||
$this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs'); | $this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs'); | ||||
} else if ($this->needWidgetData) { | } | ||||
if ($this->needWidgetData) { | |||||
$this->loadCoreHandles($conpherences, 'getParticipantPHIDs'); | $this->loadCoreHandles($conpherences, 'getParticipantPHIDs'); | ||||
} | } | ||||
if ($this->needTransactions) { | if ($this->needTransactions) { | ||||
$this->loadTransactionsAndHandles($conpherences); | $this->loadTransactionsAndHandles($conpherences); | ||||
} | } | ||||
if ($this->needFilePHIDs || $this->needWidgetData) { | if ($this->needFilePHIDs || $this->needWidgetData) { | ||||
$this->loadFilePHIDs($conpherences); | $this->loadFilePHIDs($conpherences); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | private function loadCoreHandles( | ||||
} | } | ||||
$flat_phids = array_mergev($handle_phids); | $flat_phids = array_mergev($handle_phids); | ||||
$handles = id(new PhabricatorHandleQuery()) | $handles = id(new PhabricatorHandleQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withPHIDs($flat_phids) | ->withPHIDs($flat_phids) | ||||
->execute(); | ->execute(); | ||||
foreach ($handle_phids as $conpherence_phid => $phids) { | foreach ($handle_phids as $conpherence_phid => $phids) { | ||||
$conpherence = $conpherences[$conpherence_phid]; | $conpherence = $conpherences[$conpherence_phid]; | ||||
$conpherence->attachHandles(array_select_keys($handles, $phids)); | $conpherence->attachHandles( | ||||
$conpherence->getHandles() + array_select_keys($handles, $phids)); | |||||
} | } | ||||
return $this; | return $this; | ||||
} | } | ||||
private function loadTransactionsAndHandles(array $conpherences) { | private function loadTransactionsAndHandles(array $conpherences) { | ||||
$query = id(new ConpherenceTransactionQuery()) | $query = id(new ConpherenceTransactionQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
->withObjectPHIDs(array_keys($conpherences)) | ->withObjectPHIDs(array_keys($conpherences)) | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |