Skip to content

Commit b9868f4

Browse files
author
epriestley
committed
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
1 parent f462639 commit b9868f4

File tree

4 files changed

+4
-37
lines changed

4 files changed

+4
-37
lines changed

src/applications/conpherence/controller/ConpherenceColumnViewController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function handleRequest(AphrontRequest $request) {
6767
$transactions = $conpherence->getTransactions();
6868
$latest_transaction = head($transactions);
6969
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
70-
$participant->markUpToDate($conpherence, $latest_transaction);
70+
$participant->markUpToDate($conpherence);
7171
unset($write_guard);
7272

7373
$draft = PhabricatorDraft::newFromUserAndKey(

src/applications/conpherence/controller/ConpherenceUpdateController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ private function loadAndRenderUpdates(
531531
$key = PhabricatorConpherenceColumnMinimizeSetting::SETTINGKEY;
532532
$minimized = $user->getUserSetting($key);
533533
if (!$minimized) {
534-
$participant->markUpToDate($conpherence, $data['latest_transaction']);
534+
$participant->markUpToDate($conpherence);
535535
}
536536
} else if ($need_transactions) {
537537
$non_update = true;

src/applications/conpherence/controller/ConpherenceViewController.php

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,11 @@ public function handleRequest(AphrontRequest $request) {
5555
}
5656
$this->setConpherence($conpherence);
5757

58-
$transactions = $this->getNeededTransactions(
59-
$conpherence,
60-
$old_message_id);
61-
$latest_transaction = head($transactions);
6258
$participant = $conpherence->getParticipantIfExists($user->getPHID());
6359
if ($participant) {
6460
if (!$participant->isUpToDate($conpherence)) {
6561
$write_guard = AphrontWriteGuard::beginScopedUnguardedWrites();
66-
$participant->markUpToDate($conpherence, $latest_transaction);
62+
$participant->markUpToDate($conpherence);
6763
$user->clearCacheData(PhabricatorUserMessageCountCacheType::KEY_COUNT);
6864
unset($write_guard);
6965
}
@@ -199,33 +195,6 @@ private function renderFormContent() {
199195
}
200196
}
201197

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-
}
228-
229198
private function getMainQueryLimit() {
230199
$request = $this->getRequest();
231200
$base_limit = ConpherenceThreadQuery::TRANSACTION_LIMIT;

src/applications/conpherence/storage/ConpherenceParticipant.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public function getSettings() {
3131
return nonempty($this->settings, array());
3232
}
3333

34-
public function markUpToDate(
35-
ConpherenceThread $conpherence,
36-
ConpherenceTransaction $xaction) {
34+
public function markUpToDate(ConpherenceThread $conpherence) {
3735

3836
if (!$this->isUpToDate($conpherence)) {
3937
$this->setSeenMessageCount($conpherence->getMessageCount());

0 commit comments

Comments
 (0)