1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Adding ID to each message, ensure every message is shown only once

This commit is contained in:
Tim Düsterhus 2012-02-05 19:06:00 +01:00
parent 3243f82f07
commit 3ae3909b55
2 changed files with 9 additions and 6 deletions

View File

@ -252,10 +252,12 @@ consoleMock ?=
# Insert the messages # Insert the messages
for message in messages for message in messages
continue if $.wcfIsset 'timsChatMessage'+message.messageID # Prevent problems with race condition
@events.newMessage.fire message @events.newMessage.fire message
output = @messageTemplate.fetch message output = @messageTemplate.fetch message
li = $ '<li></li>' li = $ '<li></li>'
li.attr 'id', 'timsChatMessage'+message.messageID
li.addClass 'timsChatMessage timsChatMessage'+message.type li.addClass 'timsChatMessage timsChatMessage'+message.type
li.addClass 'ownMessage' if message.sender is WCF.User.userID li.addClass 'ownMessage' if message.sender is WCF.User.userID
li.append output li.append output

View File

@ -103,7 +103,8 @@ public function jsonify($raw = false) {
'time' => $this->time, 'time' => $this->time,
'receiver' => $this->receiver, 'receiver' => $this->receiver,
'type' => $this->type, 'type' => $this->type,
'roomID' => $this->roomID 'roomID' => $this->roomID,
'messageID' => $this->messageID
); );
if ($raw) return $array; if ($raw) return $array;