1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Fix chatLastSeen on join

This commit is contained in:
Tim Düsterhus 2013-06-23 17:59:14 +02:00
parent 8ac930b952
commit 7ca00744da

View File

@ -223,19 +223,20 @@ public function join() {
$newestMessages = message\ViewableMessageList::getNewestMessages($room, CHAT_LASTMESSAGES + CHAT_DISPLAY_JOIN_LEAVE);
try {
$lastSeen = end($newestMessages)->messageID;
}
catch (\wcf\system\exception\SystemException $e) {
$lastSeen = 0;
}
// update last seen message
$sql = "SELECT
MAX(messageID)
FROM
chat".WCF_N."_message";
$stmt = WCF::getDB()->prepareStatement($sql);
$stmt->execute();
$editor = new \wcf\data\user\UserEditor($this->parameters['user']);
$editor->update(array(
'chatRoomID' => $room->roomID,
'chatAway' => null,
'chatLastActivity' => TIME_NOW,
'chatLastSeen' => $lastSeen
'chatLastSeen' => $stmt->fetchColumn()
));
// add activity points