mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 13:00:56 +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:
parent
c13f9d157b
commit
1f8b237a0f
2 changed files with 9 additions and 1 deletions
|
@ -324,7 +324,7 @@ final class ConpherenceUpdateController
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
$conpherence = id(new ConpherenceThreadQuery())
|
$conpherence = id(new ConpherenceThreadQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->setAfterID($latest_transaction_id)
|
->setBeforeMessageID($latest_transaction_id)
|
||||||
->needHeaderPics(true)
|
->needHeaderPics(true)
|
||||||
->needWidgetData(true)
|
->needWidgetData(true)
|
||||||
->needAllTransactions(true)
|
->needAllTransactions(true)
|
||||||
|
|
|
@ -12,6 +12,7 @@ final class ConpherenceThreadQuery
|
||||||
private $needHeaderPics;
|
private $needHeaderPics;
|
||||||
private $needOrigPics;
|
private $needOrigPics;
|
||||||
private $needAllTransactions;
|
private $needAllTransactions;
|
||||||
|
private $beforeMessageID;
|
||||||
|
|
||||||
public function needOrigPics($need_orig_pics) {
|
public function needOrigPics($need_orig_pics) {
|
||||||
$this->needOrigPics = $need_orig_pics;
|
$this->needOrigPics = $need_orig_pics;
|
||||||
|
@ -43,6 +44,12 @@ final class ConpherenceThreadQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This is pretty hacky!
|
||||||
|
public function setBeforeMessageID($id) {
|
||||||
|
$this->beforeMessageID = $id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function loadPage() {
|
||||||
$table = new ConpherenceThread();
|
$table = new ConpherenceThread();
|
||||||
$conn_r = $table->establishConnection('r');
|
$conn_r = $table->establishConnection('r');
|
||||||
|
@ -124,6 +131,7 @@ final class ConpherenceThreadQuery
|
||||||
->setViewer($this->getViewer())
|
->setViewer($this->getViewer())
|
||||||
->withObjectPHIDs(array_keys($conpherences))
|
->withObjectPHIDs(array_keys($conpherences))
|
||||||
->needHandles(true)
|
->needHandles(true)
|
||||||
|
->setBeforeID($this->beforeMessageID)
|
||||||
->execute();
|
->execute();
|
||||||
$transactions = mgroup($transactions, 'getObjectPHID');
|
$transactions = mgroup($transactions, 'getObjectPHID');
|
||||||
foreach ($conpherences as $phid => $conpherence) {
|
foreach ($conpherences as $phid => $conpherence) {
|
||||||
|
|
Loading…
Reference in a new issue