@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
1<?php
2
3final class ConpherenceParticipant extends ConpherenceDAO {
4
5 protected $participantPHID;
6 protected $conpherencePHID;
7 protected $seenMessageCount;
8 protected $settings = array();
9
10 protected function getConfiguration() {
11 return array(
12 self::CONFIG_SERIALIZATION => array(
13 'settings' => self::SERIALIZATION_JSON,
14 ),
15 self::CONFIG_COLUMN_SCHEMA => array(
16 'seenMessageCount' => 'uint64',
17 ),
18 self::CONFIG_KEY_SCHEMA => array(
19 'conpherencePHID' => array(
20 'columns' => array('conpherencePHID', 'participantPHID'),
21 'unique' => true,
22 ),
23 'key_thread' => array(
24 'columns' => array('participantPHID', 'conpherencePHID'),
25 ),
26 ),
27 ) + parent::getConfiguration();
28 }
29
30 public function getSettings() {
31 return nonempty($this->settings, array());
32 }
33
34 public function markUpToDate(ConpherenceThread $conpherence) {
35
36 if (!$this->isUpToDate($conpherence)) {
37 $this->setSeenMessageCount($conpherence->getMessageCount());
38 $this->save();
39
40 PhabricatorUserCache::clearCache(
41 PhabricatorUserMessageCountCacheType::KEY_COUNT,
42 $this->getParticipantPHID());
43 }
44
45 return $this;
46 }
47
48 public function isUpToDate(ConpherenceThread $conpherence) {
49 return ($this->getSeenMessageCount() == $conpherence->getMessageCount());
50 }
51
52}