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

Improve private channels

Follow up messages will be shown in opened private channels
This commit is contained in:
Maximilian Mader 2013-07-09 20:30:46 +02:00
parent 7cb15e5e9c
commit fa03296908

View File

@ -418,9 +418,11 @@ Insert the given messages into the chat stream.
for message in messages for message in messages
events.newMessage.fire message events.newMessage.fire message
message.private = (message.type is parseInt v.config.messageTypes.WHISPER) and ($.wcfIsset("timsChatMessageContainer#{message.receiver}") || $.wcfIsset("timsChatMessageContainer#{message.sender}"))
createNewMessage = yes createNewMessage = yes
if $('.timsChatMessage:last-child .text').is('ul') and lastMessage isnt null and lastMessage.type in [ 0, 7 ] 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 if lastMessage.type is message.type and lastMessage.sender is message.sender and lastMessage.receiver is message.receiver and lastMessage.private is message.private
createNewMessage = no createNewMessage = no
if createNewMessage if createNewMessage
@ -436,22 +438,26 @@ Insert the given messages into the chat stream.
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
if message.type is parseInt v.config.messageTypes.WHISPER if message.private and message.sender is WCF.User.userID
if message.sender is WCF.User.userID && $.wcfIsset "timsChatMessageContainer#{message.receiver}"
li.appendTo $ "#timsChatMessageContainer#{message.receiver} > ul" li.appendTo $ "#timsChatMessageContainer#{message.receiver} > ul"
else if $.wcfIsset "timsChatMessageContainer#{message.sender}" else if message.private
li.appendTo $ "#timsChatMessageContainer#{message.sender} > ul" li.appendTo $ "#timsChatMessageContainer#{message.sender} > ul"
else else
li.appendTo $ '#timsChatMessageContainer0 > ul' li.appendTo $ '#timsChatMessageContainer0 > ul'
else
li.appendTo $ '#timsChatMessageContainer0 > ul'
else else
message.isFollowUp = yes message.isFollowUp = yes
output = v.messageTemplate.fetch output = v.messageTemplate.fetch
message: message message: message
messageTypes: v.config.messageTypes messageTypes: v.config.messageTypes
$('.timsChatMessage:last-child .text').append $(output).find('.text li:last-child') if message.private and message.sender is WCF.User.userID
messageContainerID = message.receiver
else if message.private
messageContainerID = message.sender
else
messageContainerID = 0
$("#timsChatMessageContainer#{messageContainerID} .timsChatMessage:last-child .text").append $(output).find('.text li:last-child')
lastMessage = message lastMessage = message
$('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop('scrollHeight') if $('#timsChatAutoscroll').data('status') is 1 $('.timsChatMessageContainer.active').scrollTop $('.timsChatMessageContainer.active').prop('scrollHeight') if $('#timsChatAutoscroll').data('status') is 1