1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40: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); $newestMessages = message\ViewableMessageList::getNewestMessages($room, CHAT_LASTMESSAGES + CHAT_DISPLAY_JOIN_LEAVE);
try { // update last seen message
$lastSeen = end($newestMessages)->messageID; $sql = "SELECT
} MAX(messageID)
catch (\wcf\system\exception\SystemException $e) { FROM
$lastSeen = 0; chat".WCF_N."_message";
} $stmt = WCF::getDB()->prepareStatement($sql);
$stmt->execute();
$editor = new \wcf\data\user\UserEditor($this->parameters['user']); $editor = new \wcf\data\user\UserEditor($this->parameters['user']);
$editor->update(array( $editor->update(array(
'chatRoomID' => $room->roomID, 'chatRoomID' => $room->roomID,
'chatAway' => null, 'chatAway' => null,
'chatLastActivity' => TIME_NOW, 'chatLastActivity' => TIME_NOW,
'chatLastSeen' => $lastSeen 'chatLastSeen' => $stmt->fetchColumn()
)); ));
// add activity points // add activity points