@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

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

+4 -37
+1 -1
src/applications/conpherence/controller/ConpherenceColumnViewController.php
··· 67 67 $transactions = $conpherence->getTransactions(); 68 68 $latest_transaction = head($transactions); 69 69 $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites(); 70 - $participant->markUpToDate($conpherence, $latest_transaction); 70 + $participant->markUpToDate($conpherence); 71 71 unset($write_guard); 72 72 73 73 $draft = PhabricatorDraft::newFromUserAndKey(
+1 -1
src/applications/conpherence/controller/ConpherenceUpdateController.php
··· 531 531 $key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY; 532 532 $minimized = $user->getUserSetting($key); 533 533 if (!$minimized) { 534 - $participant->markUpToDate($conpherence, $data['latest_transaction']); 534 + $participant->markUpToDate($conpherence); 535 535 } 536 536 } else if ($need_transactions) { 537 537 $non_update = true;
+1 -32
src/applications/conpherence/controller/ConpherenceViewController.php
··· 55 55 } 56 56 $this->setConpherence($conpherence); 57 57 58 - $transactions = $this->getNeededTransactions( 59 - $conpherence, 60 - $old_message_id); 61 - $latest_transaction = head($transactions); 62 58 $participant = $conpherence->getParticipantIfExists($user->getPHID()); 63 59 if ($participant) { 64 60 if (!$participant->isUpToDate($conpherence)) { 65 61 $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites(); 66 - $participant->markUpToDate($conpherence, $latest_transaction); 62 + $participant->markUpToDate($conpherence); 67 63 $user->clearCacheData(PhabricatorUserMessageCountCacheType::KEY_COUNT); 68 64 unset($write_guard); 69 65 } ··· 197 193 ->setText(pht('Login to Participate')) 198 194 ->setHref((string)$login_href)); 199 195 } 200 - } 201 - 202 - private function getNeededTransactions( 203 - ConpherenceThread $conpherence, 204 - $message_id) { 205 - 206 - if ($message_id) { 207 - $newer_transactions = $conpherence->getTransactions(); 208 - $query = id(new ConpherenceTransactionQuery()) 209 - ->setViewer($this->getRequest()->getUser()) 210 - ->withObjectPHIDs(array($conpherence->getPHID())) 211 - ->setAfterID($message_id) 212 - ->needHandles(true) 213 - ->setLimit(self::OLDER_FETCH_LIMIT); 214 - $older_transactions = $query->execute(); 215 - $handles = array(); 216 - foreach ($older_transactions as $transaction) { 217 - $handles += $transaction->getHandles(); 218 - } 219 - $conpherence->attachHandles($conpherence->getHandles() + $handles); 220 - $transactions = array_merge($newer_transactions, $older_transactions); 221 - $conpherence->attachTransactions($transactions); 222 - } else { 223 - $transactions = $conpherence->getTransactions(); 224 - } 225 - 226 - return $transactions; 227 196 } 228 197 229 198 private function getMainQueryLimit() {
+1 -3
src/applications/conpherence/storage/ConpherenceParticipant.php
··· 31 31 return nonempty($this->settings, array()); 32 32 } 33 33 34 - public function markUpToDate( 35 - ConpherenceThread $conpherence, 36 - ConpherenceTransaction $xaction) { 34 + public function markUpToDate(ConpherenceThread $conpherence) { 37 35 38 36 if (!$this->isUpToDate($conpherence)) { 39 37 $this->setSeenMessageCount($conpherence->getMessageCount());