diff options
author | Joas Schilling <coding@schilljs.com> | 2019-10-01 10:54:40 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2019-10-01 10:54:40 +0300 |
commit | 733da0c4c24207fbb5084db781af81775cdf96cd (patch) | |
tree | 5252277cb07dd2c33aee3cd6907075524990b5af /lib/Room.php | |
parent | bdb9b52cbfc2896b8e27884b6ea4f70f6665e420 (diff) |
Correctly set the unread counter when readding a user to a one-to-one conversation
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r-- | lib/Room.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Room.php b/lib/Room.php index c0fcb8b77..08ee9b506 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -91,6 +91,8 @@ class Room { private $activeSince; /** @var \DateTime|null */ private $lastActivity; + /** @var int */ + private $lastMessageId; /** @var IComment|null */ private $lastMessage; /** @var string */ @@ -119,6 +121,7 @@ class Room { int $activeGuests, \DateTime $activeSince = null, \DateTime $lastActivity = null, + int $lastMessageId, IComment $lastMessage = null, \DateTime $lobbyTimer = null, string $objectType = '', @@ -139,6 +142,7 @@ class Room { $this->activeGuests = $activeGuests; $this->activeSince = $activeSince; $this->lastActivity = $lastActivity; + $this->lastMessageId = $lastMessageId; $this->lastMessage = $lastMessage; $this->lobbyTimer = $lobbyTimer; $this->objectType = $objectType; @@ -198,6 +202,13 @@ class Room { } public function getLastMessage(): ?IComment { + if ($this->lastMessageId && $this->lastMessage === null) { + $this->lastMessage = $this->manager->loadLastCommentInfo($this->lastMessageId); + if ($this->lastMessage === null) { + $this->lastMessageId = 0; + } + } + return $this->lastMessage; } |