mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 16:52:41 +01:00
Fix an unusual internal cursor in Conpherence
Summary: See <https://discourse.phabricator-community.org/t/error-when-sending-a-message-chat-room/2548>. Conpherence calls `setAfterID()` and `setBeforeID()` directly on a subquery, but these methods no longer exist. Use a pager instead. This code probably shouldn't exist (we should use some other approach to fetch this data in most cases) but that's a larger change. Test Plan: Sent messages in a Conpherence thread. Before: fatal; after: success. Viewed the Conphrence menu, loaded threads, etc. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D20318
This commit is contained in:
parent
7f90570636
commit
2ebe675ae5
1 changed files with 23 additions and 11 deletions
|
@ -285,23 +285,35 @@ final class ConpherenceThreadQuery
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadTransactionsAndHandles(array $conpherences) {
|
private function loadTransactionsAndHandles(array $conpherences) {
|
||||||
$query = id(new ConpherenceTransactionQuery())
|
// NOTE: This is older code which has been modernized to the minimum
|
||||||
->setViewer($this->getViewer())
|
// standard required by T13266. It probably isn't the best available
|
||||||
->withObjectPHIDs(array_keys($conpherences))
|
// approach to the problems it solves.
|
||||||
->needHandles(true);
|
|
||||||
|
$limit = $this->getTransactionLimit();
|
||||||
|
if ($limit) {
|
||||||
|
// fetch an extra for "show older" scenarios
|
||||||
|
$limit = $limit + 1;
|
||||||
|
} else {
|
||||||
|
$limit = 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pager = id(new AphrontCursorPagerView())
|
||||||
|
->setPageSize($limit);
|
||||||
|
|
||||||
// We have to flip these for the underlying query class. The semantics of
|
// We have to flip these for the underlying query class. The semantics of
|
||||||
// paging are tricky business.
|
// paging are tricky business.
|
||||||
if ($this->afterTransactionID) {
|
if ($this->afterTransactionID) {
|
||||||
$query->setBeforeID($this->afterTransactionID);
|
$pager->setBeforeID($this->afterTransactionID);
|
||||||
} else if ($this->beforeTransactionID) {
|
} else if ($this->beforeTransactionID) {
|
||||||
$query->setAfterID($this->beforeTransactionID);
|
$pager->setAfterID($this->beforeTransactionID);
|
||||||
}
|
}
|
||||||
if ($this->getTransactionLimit()) {
|
|
||||||
// fetch an extra for "show older" scenarios
|
$transactions = id(new ConpherenceTransactionQuery())
|
||||||
$query->setLimit($this->getTransactionLimit() + 1);
|
->setViewer($this->getViewer())
|
||||||
}
|
->withObjectPHIDs(array_keys($conpherences))
|
||||||
$transactions = $query->execute();
|
->needHandles(true)
|
||||||
|
->executeWithCursorPager($pager);
|
||||||
|
|
||||||
$transactions = mgroup($transactions, 'getObjectPHID');
|
$transactions = mgroup($transactions, 'getObjectPHID');
|
||||||
foreach ($conpherences as $phid => $conpherence) {
|
foreach ($conpherences as $phid => $conpherence) {
|
||||||
$current_transactions = idx($transactions, $phid, array());
|
$current_transactions = idx($transactions, $phid, array());
|
||||||
|
|
Loading…
Reference in a new issue