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:
parent
3243f82f07
commit
3ae3909b55
@ -118,11 +118,11 @@ consoleMock ?=
|
||||
|
||||
# Clears the stream
|
||||
$('#timsChatClear').click (event) ->
|
||||
event.preventDefault()
|
||||
$('.timsChatMessage').remove()
|
||||
@oldScrollTop = $('.timsChatMessageContainer').scrollTop()
|
||||
$('.timsChatMessageContainer').scrollTop $('.timsChatMessageContainer ul').height()
|
||||
$('#timsChatInput').focus()
|
||||
event.preventDefault()
|
||||
$('.timsChatMessage').remove()
|
||||
@oldScrollTop = $('.timsChatMessageContainer').scrollTop()
|
||||
$('.timsChatMessageContainer').scrollTop $('.timsChatMessageContainer ul').height()
|
||||
$('#timsChatInput').focus()
|
||||
|
||||
# Toggle Buttons
|
||||
$('.timsChatToggle').click (event) ->
|
||||
@ -252,10 +252,12 @@ consoleMock ?=
|
||||
|
||||
# Insert the messages
|
||||
for message in messages
|
||||
continue if $.wcfIsset 'timsChatMessage'+message.messageID # Prevent problems with race condition
|
||||
@events.newMessage.fire message
|
||||
|
||||
output = @messageTemplate.fetch message
|
||||
li = $ '<li></li>'
|
||||
li.attr 'id', 'timsChatMessage'+message.messageID
|
||||
li.addClass 'timsChatMessage timsChatMessage'+message.type
|
||||
li.addClass 'ownMessage' if message.sender is WCF.User.userID
|
||||
li.append output
|
||||
|
@ -103,7 +103,8 @@ public function jsonify($raw = false) {
|
||||
'time' => $this->time,
|
||||
'receiver' => $this->receiver,
|
||||
'type' => $this->type,
|
||||
'roomID' => $this->roomID
|
||||
'roomID' => $this->roomID,
|
||||
'messageID' => $this->messageID
|
||||
);
|
||||
|
||||
if ($raw) return $array;
|
||||
|
Loading…
Reference in New Issue
Block a user