@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+23 -11
+23 -11
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 285 285 } 286 286 287 287 private function loadTransactionsAndHandles(array $conpherences) { 288 - $query = id(new ConpherenceTransactionQuery()) 289 - ->setViewer($this->getViewer()) 290 - ->withObjectPHIDs(array_keys($conpherences)) 291 - ->needHandles(true); 288 + // NOTE: This is older code which has been modernized to the minimum 289 + // standard required by T13266. It probably isn't the best available 290 + // approach to the problems it solves. 291 + 292 + $limit = $this->getTransactionLimit(); 293 + if ($limit) { 294 + // fetch an extra for "show older" scenarios 295 + $limit = $limit + 1; 296 + } else { 297 + $limit = 0xFFFF; 298 + } 299 + 300 + $pager = id(new AphrontCursorPagerView()) 301 + ->setPageSize($limit); 292 302 293 303 // We have to flip these for the underlying query class. The semantics of 294 304 // paging are tricky business. 295 305 if ($this->afterTransactionID) { 296 - $query->setBeforeID($this->afterTransactionID); 306 + $pager->setBeforeID($this->afterTransactionID); 297 307 } else if ($this->beforeTransactionID) { 298 - $query->setAfterID($this->beforeTransactionID); 308 + $pager->setAfterID($this->beforeTransactionID); 299 309 } 300 - if ($this->getTransactionLimit()) { 301 - // fetch an extra for "show older" scenarios 302 - $query->setLimit($this->getTransactionLimit() + 1); 303 - } 304 - $transactions = $query->execute(); 310 + 311 + $transactions = id(new ConpherenceTransactionQuery()) 312 + ->setViewer($this->getViewer()) 313 + ->withObjectPHIDs(array_keys($conpherences)) 314 + ->needHandles(true) 315 + ->executeWithCursorPager($pager); 316 + 305 317 $transactions = mgroup($transactions, 'getObjectPHID'); 306 318 foreach ($conpherences as $phid => $conpherence) { 307 319 $current_transactions = idx($transactions, $phid, array());