1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-21 04:50:55 +01:00

Stop Conpherence from reloading all messages on reply

Summary:
Currently, when you reply to a Conpherence thread, we load //all// the messages, not just the most recent ones. I don't //think// I broke this, it's just hard to tell that's what's happening unless the thread is very short or you scroll up.

The issue is that we're loading //threads// after some ID, but actually need to load //messages// (transactions) after that ID. Also, the way "before" and "after" work is sort of weird so this actually needs to be "before" (we should probably invert the meanings). Ref T2421.

Test Plan: Replied to a very short thread; saw no duplicate messages.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2421

Differential Revision: https://secure.phabricator.com/D5537
This commit is contained in:
epriestley 2013-04-02 10:34:24 -07:00
parent c13f9d157b
commit 1f8b237a0f
2 changed files with 9 additions and 1 deletions

View file

@ -324,7 +324,7 @@ final class ConpherenceUpdateController
$user = $this->getRequest()->getUser();
$conpherence = id(new ConpherenceThreadQuery())
->setViewer($user)
->setAfterID($latest_transaction_id)
->setBeforeMessageID($latest_transaction_id)
->needHeaderPics(true)
->needWidgetData(true)
->needAllTransactions(true)

View file

@ -12,6 +12,7 @@ final class ConpherenceThreadQuery
private $needHeaderPics;
private $needOrigPics;
private $needAllTransactions;
private $beforeMessageID;
public function needOrigPics($need_orig_pics) {
$this->needOrigPics = $need_orig_pics;
@ -43,6 +44,12 @@ final class ConpherenceThreadQuery
return $this;
}
// TODO: This is pretty hacky!
public function setBeforeMessageID($id) {
$this->beforeMessageID = $id;
return $this;
}
protected function loadPage() {
$table = new ConpherenceThread();
$conn_r = $table->establishConnection('r');
@ -124,6 +131,7 @@ final class ConpherenceThreadQuery
->setViewer($this->getViewer())
->withObjectPHIDs(array_keys($conpherences))
->needHandles(true)
->setBeforeID($this->beforeMessageID)
->execute();
$transactions = mgroup($transactions, 'getObjectPHID');
foreach ($conpherences as $phid => $conpherence) {