mirror of
https://we.phorge.it/source/phorge.git
synced 2024-09-22 10:18:48 +02:00
943c62d1e9
Summary: Ref T1191. - Adds definitions for missing keys and keys with wrong uniqueness. Generally, I defined these before fixing the key query to actually pull all keys and support uniqueness. - Moves "key uniqueness" to note severity; this is fixable (probably?) and there are no remaining issues. - Moves "Missing Key" to note severity; missing keys are fixable and all remaining missing keys are really missing (either missing edge keys, or missing PHID keys): {F210089} - Moves "Surplus Key" to note seveirty; surplus keys are fixable all remaining surplus keys are really surplus (duplicate key in Harbormaster, key on unused column in Worker): {F210090} Test Plan: - Vetted missing/surplus/unique messages. - 146 issues remaining. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T1191 Differential Revision: https://secure.phabricator.com/D10590
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
final class ConpherenceParticipant extends ConpherenceDAO {
|
|
|
|
protected $participantPHID;
|
|
protected $conpherencePHID;
|
|
protected $participationStatus;
|
|
protected $behindTransactionPHID;
|
|
protected $seenMessageCount;
|
|
protected $dateTouched;
|
|
protected $settings = array();
|
|
|
|
public function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_SERIALIZATION => array(
|
|
'settings' => self::SERIALIZATION_JSON,
|
|
),
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
'participationStatus' => 'uint32',
|
|
'dateTouched' => 'epoch',
|
|
'seenMessageCount' => 'uint64',
|
|
),
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
'conpherencePHID' => array(
|
|
'columns' => array('conpherencePHID', 'participantPHID'),
|
|
'unique' => true,
|
|
),
|
|
'unreadCount' => array(
|
|
'columns' => array('participantPHID', 'participationStatus'),
|
|
),
|
|
'participationIndex' => array(
|
|
'columns' => array('participantPHID', 'dateTouched', 'id'),
|
|
),
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public function getSettings() {
|
|
return nonempty($this->settings, array());
|
|
}
|
|
|
|
public function markUpToDate(
|
|
ConpherenceThread $conpherence,
|
|
ConpherenceTransaction $xaction) {
|
|
if (!$this->isUpToDate($conpherence)) {
|
|
$this->setParticipationStatus(ConpherenceParticipationStatus::UP_TO_DATE);
|
|
$this->setBehindTransactionPHID($xaction->getPHID());
|
|
$this->setSeenMessageCount($conpherence->getMessageCount());
|
|
$this->save();
|
|
}
|
|
return $this;
|
|
}
|
|
|
|
private function isUpToDate(ConpherenceThread $conpherence) {
|
|
return
|
|
($this->getSeenMessageCount() == $conpherence->getMessageCount())
|
|
&&
|
|
($this->getParticipationStatus() ==
|
|
ConpherenceParticipationStatus::UP_TO_DATE);
|
|
}
|
|
|
|
}
|