mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +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();
|
$transactions = $conpherence->getTransactions();
|
||||||
$latest_transaction = head($transactions);
|
$latest_transaction = head($transactions);
|
||||||
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||||
$participant->markUpToDate($conpherence, $latest_transaction);
|
$participant->markUpToDate($conpherence);
|
||||||
unset($write_guard);
|
unset($write_guard);
|
||||||
|
|
||||||
$draft = PhabricatorDraft::newFromUserAndKey(
|
$draft = PhabricatorDraft::newFromUserAndKey(
|
||||||
|
|
|
@ -531,7 +531,7 @@ final class ConpherenceUpdateController
|
||||||
$key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY;
|
$key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY;
|
||||||
$minimized = $user->getUserSetting($key);
|
$minimized = $user->getUserSetting($key);
|
||||||
if (!$minimized) {
|
if (!$minimized) {
|
||||||
$participant->markUpToDate($conpherence, $data['latest_transaction']);
|
$participant->markUpToDate($conpherence);
|
||||||
}
|
}
|
||||||
} else if ($need_transactions) {
|
} else if ($need_transactions) {
|
||||||
$non_update = true;
|
$non_update = true;
|
||||||
|
|
|
@ -55,15 +55,11 @@ final class ConpherenceViewController extends
|
||||||
}
|
}
|
||||||
$this->setConpherence($conpherence);
|
$this->setConpherence($conpherence);
|
||||||
|
|
||||||
$transactions = $this->getNeededTransactions(
|
|
||||||
$conpherence,
|
|
||||||
$old_message_id);
|
|
||||||
$latest_transaction = head($transactions);
|
|
||||||
$participant = $conpherence->getParticipantIfExists($user->getPHID());
|
$participant = $conpherence->getParticipantIfExists($user->getPHID());
|
||||||
if ($participant) {
|
if ($participant) {
|
||||||
if (!$participant->isUpToDate($conpherence)) {
|
if (!$participant->isUpToDate($conpherence)) {
|
||||||
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||||
$participant->markUpToDate($conpherence, $latest_transaction);
|
$participant->markUpToDate($conpherence);
|
||||||
$user->clearCacheData(PhabricatorUserMessageCountCacheType::KEY_COUNT);
|
$user->clearCacheData(PhabricatorUserMessageCountCacheType::KEY_COUNT);
|
||||||
unset($write_guard);
|
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() {
|
private function getMainQueryLimit() {
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$base_limit = ConpherenceThreadQuery::TRANSACTION_LIMIT;
|
$base_limit = ConpherenceThreadQuery::TRANSACTION_LIMIT;
|
||||||
|
|
|
@ -31,9 +31,7 @@ final class ConpherenceParticipant extends ConpherenceDAO {
|
||||||
return nonempty($this->settings, array());
|
return nonempty($this->settings, array());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function markUpToDate(
|
public function markUpToDate(ConpherenceThread $conpherence) {
|
||||||
ConpherenceThread $conpherence,
|
|
||||||
ConpherenceTransaction $xaction) {
|
|
||||||
|
|
||||||
if (!$this->isUpToDate($conpherence)) {
|
if (!$this->isUpToDate($conpherence)) {
|
||||||
$this->setSeenMessageCount($conpherence->getMessageCount());
|
$this->setSeenMessageCount($conpherence->getMessageCount());
|
||||||
|
|
Loading…
Reference in a new issue