mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Conpherence - fix unread counts
Summary: we weren't updating the "latest seen transaction PHID" properly. do that and ONLY do it from the view handler so we know the user got a real good chance of actually seeing the message. also we weren't searching through the transactions correctly; fix that. Test Plan: sent a test user some messages. noted the proper count of unread messages. Reviewers: epriestley, chad Reviewed By: chad CC: aran, Korvin Maniphest Tasks: T2399 Differential Revision: https://secure.phabricator.com/D4677
This commit is contained in:
parent
9437bc019d
commit
22ce74c5a8
4 changed files with 12 additions and 10 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue