diff --git a/src/applications/conpherence/controller/ConpherenceListController.php b/src/applications/conpherence/controller/ConpherenceListController.php index 80ef89d66a..916d044e86 100644 --- a/src/applications/conpherence/controller/ConpherenceListController.php +++ b/src/applications/conpherence/controller/ConpherenceListController.php @@ -41,11 +41,7 @@ final class ConpherenceListController extends } $this->setSelectedConpherencePHID($conpherence->getPHID()); - $read_status = ConpherenceParticipationStatus::UP_TO_DATE; $participant = $conpherence->getParticipant($user->getPHID()); - $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites(); - $participant->markUpToDate(); - unset($write_guard); $current_selection_epoch = $participant->getDateTouched(); } diff --git a/src/applications/conpherence/controller/ConpherenceViewController.php b/src/applications/conpherence/controller/ConpherenceViewController.php index 284d237802..d615edac50 100644 --- a/src/applications/conpherence/controller/ConpherenceViewController.php +++ b/src/applications/conpherence/controller/ConpherenceViewController.php @@ -49,8 +49,10 @@ final class ConpherenceViewController extends $this->setConpherence($conpherence); $participant = $conpherence->getParticipant($user->getPHID()); + $transactions = $conpherence->getTransactions(); + $latest_transaction = end($transactions); $write_guard = AphrontWriteGuard::beginScopedUnguardedWrites(); - $participant->markUpToDate(); + $participant->markUpToDate($latest_transaction); unset($write_guard); $header = $this->renderHeaderPaneContent(); diff --git a/src/applications/conpherence/storage/ConpherenceParticipant.php b/src/applications/conpherence/storage/ConpherenceParticipant.php index e21d6204ad..be897c11fe 100644 --- a/src/applications/conpherence/storage/ConpherenceParticipant.php +++ b/src/applications/conpherence/storage/ConpherenceParticipant.php @@ -11,9 +11,10 @@ final class ConpherenceParticipant extends ConpherenceDAO { protected $behindTransactionPHID; protected $dateTouched; - public function markUpToDate() { + public function markUpToDate(ConpherenceTransaction $xaction) { if (!$this->isUpToDate()) { $this->setParticipationStatus(ConpherenceParticipationStatus::UP_TO_DATE); + $this->setBehindTransactionPHID($xaction->getPHID()); $this->save(); } return $this; diff --git a/src/applications/conpherence/storage/ConpherenceThread.php b/src/applications/conpherence/storage/ConpherenceThread.php index c5c2c4723a..1b80aec1a5 100644 --- a/src/applications/conpherence/storage/ConpherenceThread.php +++ b/src/applications/conpherence/storage/ConpherenceThread.php @@ -189,15 +189,18 @@ final class ConpherenceThread extends ConpherenceDAO } // fallthrough intentionally here case ConpherenceTransactionType::TYPE_FILES: - default: - if ($behind_transaction_phid && - $transaction->getPHID() != $behind_transaction_phid) { - $unread_count++; + if ($behind_transaction_phid) { + $unread_count++; + if ($transaction->getPHID() == $behind_transaction_phid) { + break 2; } + } if ($unread_count > $max_count) { break 2; } break; + default: + continue 2; } if ($snippet && !$behind_transaction_phid) { break;