mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Don't require a transaction to mark a participant up-to-date
Summary: Pathway to D17685. We no longer have "behindTransactionPHID", so we no longer need the latest transaction. This allows some code to be removed. Test Plan: - Grepped for callsites to `markUpToDate()` and variables used in the calls. - Sent messages in a couple threads, viewed them, saw unread counts go away. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D17733
This commit is contained in:
parent
f46263903c
commit
b9868f4f05
4 changed files with 4 additions and 37 deletions
|
@ -67,7 +67,7 @@ final class ConpherenceColumnViewController extends
|
|||
$transactions = $conpherence->getTransactions();
|
||||
$latest_transaction = head($transactions);
|
||||
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$participant->markUpToDate($conpherence, $latest_transaction);
|
||||
$participant->markUpToDate($conpherence);
|
||||
unset($write_guard);
|
||||
|
||||
$draft = PhabricatorDraft::newFromUserAndKey(
|
||||
|
|
|
@ -531,7 +531,7 @@ final class ConpherenceUpdateController
|
|||
$key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY;
|
||||
$minimized = $user->getUserSetting($key);
|
||||
if (!$minimized) {
|
||||
$participant->markUpToDate($conpherence, $data['latest_transaction']);
|
||||
$participant->markUpToDate($conpherence);
|
||||
}
|
||||
} else if ($need_transactions) {
|
||||
$non_update = true;
|
||||
|
|
|
@ -55,15 +55,11 @@ final class ConpherenceViewController extends
|
|||
}
|
||||
$this->setConpherence($conpherence);
|
||||
|
||||
$transactions = $this->getNeededTransactions(
|
||||
$conpherence,
|
||||
$old_message_id);
|
||||
$latest_transaction = head($transactions);
|
||||
$participant = $conpherence->getParticipantIfExists($user->getPHID());
|
||||
if ($participant) {
|
||||
if (!$participant->isUpToDate($conpherence)) {
|
||||
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
$participant->markUpToDate($conpherence, $latest_transaction);
|
||||
$participant->markUpToDate($conpherence);
|
||||
$user->clearCacheData(PhabricatorUserMessageCountCacheType::KEY_COUNT);
|
||||
unset($write_guard);
|
||||
}
|
||||
|
@ -199,33 +195,6 @@ final class ConpherenceViewController extends
|
|||
}
|
||||
}
|
||||
|
||||
private function getNeededTransactions(
|
||||
ConpherenceThread $conpherence,
|
||||
$message_id) {
|
||||
|
||||
if ($message_id) {
|
||||
$newer_transactions = $conpherence->getTransactions();
|
||||
$query = id(new ConpherenceTransactionQuery())
|
||||
->setViewer($this->getRequest()->getUser())
|
||||
->withObjectPHIDs(array($conpherence->getPHID()))
|
||||
->setAfterID($message_id)
|
||||
->needHandles(true)
|
||||
->setLimit(self::OLDER_FETCH_LIMIT);
|
||||
$older_transactions = $query->execute();
|
||||
$handles = array();
|
||||
foreach ($older_transactions as $transaction) {
|
||||
$handles += $transaction->getHandles();
|
||||
}
|
||||
$conpherence->attachHandles($conpherence->getHandles() + $handles);
|
||||
$transactions = array_merge($newer_transactions, $older_transactions);
|
||||
$conpherence->attachTransactions($transactions);
|
||||
} else {
|
||||
$transactions = $conpherence->getTransactions();
|
||||
}
|
||||
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
private function getMainQueryLimit() {
|
||||
$request = $this->getRequest();
|
||||
$base_limit = ConpherenceThreadQuery::TRANSACTION_LIMIT;
|
||||
|
|
|
@ -31,9 +31,7 @@ final class ConpherenceParticipant extends ConpherenceDAO {
|
|||
return nonempty($this->settings, array());
|
||||
}
|
||||
|
||||
public function markUpToDate(
|
||||
ConpherenceThread $conpherence,
|
||||
ConpherenceTransaction $xaction) {
|
||||
public function markUpToDate(ConpherenceThread $conpherence) {
|
||||
|
||||
if (!$this->isUpToDate($conpherence)) {
|
||||
$this->setSeenMessageCount($conpherence->getMessageCount());
|
||||
|
|
Loading…
Reference in a new issue