mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Merge similar messages together
This commit is contained in:
parent
f313dde2c3
commit
42ef646685
@ -35,6 +35,8 @@ exposed by a function if necessary.
|
||||
chatSession = Date.now()
|
||||
errorVisible = false
|
||||
|
||||
lastMessage = null
|
||||
|
||||
remainingFailures = 3
|
||||
|
||||
events =
|
||||
@ -411,16 +413,25 @@ Insert the given messages into the chat stream.
|
||||
for message in messages
|
||||
events.newMessage.fire message
|
||||
|
||||
createNewMessage = yes
|
||||
if $('.timsChatMessage:last-child .text').is('ul') and lastMessage isnt null and lastMessage.type in [ 0, 7 ]
|
||||
if lastMessage.type is message.type and lastMessage.sender is message.sender and lastMessage.receiver is message.receiver
|
||||
createNewMessage = no
|
||||
|
||||
output = v.messageTemplate.fetch message
|
||||
li = $ '<li></li>'
|
||||
li.addClass 'timsChatMessage'
|
||||
li.addClass "timsChatMessage#{message.type}"
|
||||
li.addClass "user#{message.sender}"
|
||||
li.addClass 'ownMessage' if message.sender is WCF.User.userID
|
||||
li.append output
|
||||
if createNewMessage
|
||||
li = $ '<li></li>'
|
||||
li.addClass 'timsChatMessage'
|
||||
li.addClass "timsChatMessage#{message.type}"
|
||||
li.addClass "user#{message.sender}"
|
||||
li.addClass 'ownMessage' if message.sender is WCF.User.userID
|
||||
li.append output
|
||||
|
||||
li.appendTo $ '#timsChatMessageContainer > ul'
|
||||
li.appendTo $ '#timsChatMessageContainer > ul'
|
||||
else
|
||||
$('.timsChatMessage:last-child .text').append $(output).find('.text li:last-child')
|
||||
|
||||
lastMessage = message
|
||||
$('#timsChatMessageContainer').scrollTop $('#timsChatMessageContainer').prop('scrollHeight') if $('#timsChatAutoscroll').data('status') is 1
|
||||
|
||||
Rebuild the userlist based on the given `users`.
|
||||
|
Loading…
Reference in New Issue
Block a user