Only send initial message once
This commit is contained in:
parent
b830735e08
commit
9a2990fe4a
@ -81,23 +81,24 @@ Template.message.rendered = -> # When a message has been added and finished rend
|
||||
$('#chatbody').scrollTop($('#chatbody')[0].scrollHeight)
|
||||
|
||||
Template.optionsBar.events
|
||||
'click .private-chat-user-entry': (event) -> # clicked a user's name to begin private chat
|
||||
setInSession 'display_chatPane', true
|
||||
setInSession "inChatWith", @userId
|
||||
'click .private-chat-user-entry': (event) -> # clicked a user's name to begin private chat
|
||||
setInSession 'display_chatPane', true
|
||||
setInSession "inChatWith", @userId
|
||||
me = getInSession("userId")
|
||||
|
||||
messageForServer =
|
||||
"message": "#{getUsersName()} has joined private chat with #{@user.name}."
|
||||
"chat_type": "PRIVATE_CHAT"
|
||||
"from_userid": getInSession("userId")
|
||||
"from_username": getUsersName()
|
||||
"from_tz_offset": "240"
|
||||
"to_username": @user.name
|
||||
"to_userid": @userId
|
||||
"from_lang": "en"
|
||||
"from_time": getTime()
|
||||
"from_color": "0"
|
||||
|
||||
Meteor.call "sendChatMessagetoServer", getInSession("meetingId"), messageForServer
|
||||
if Meteor.Chat.find({'message.chat_type': 'PRIVATE_CHAT', $or: [{'message.from_userid': me, 'message.to_userid': @userId},{'message.from_userid': @userId, 'message.to_userid': me}]}).fetch().length is 0
|
||||
messageForServer =
|
||||
"message": "#{getUsersName()} has joined private chat with #{@user.name}."
|
||||
"chat_type": "PRIVATE_CHAT"
|
||||
"from_userid": me
|
||||
"from_username": getUsersName()
|
||||
"from_tz_offset": "240"
|
||||
"to_username": @user.name
|
||||
"to_userid": @userId
|
||||
"from_lang": "en"
|
||||
"from_time": getTime()
|
||||
"from_color": "0"
|
||||
Meteor.call "sendChatMessagetoServer", getInSession("meetingId"), messageForServer
|
||||
|
||||
Template.tabButtons.events
|
||||
'click .close': (event) -> # user closes private chat
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
<!-- Displays the list of options available -->
|
||||
<template name="optionsBar">
|
||||
<p>Select a person to chat with privately</p>
|
||||
<p> Select a person to chat with privately</p>
|
||||
<div class="private-chat-user-box">
|
||||
{{#Layout template="scrollWindow" id="privateChatUserScrollWindow"}}
|
||||
{{#contentFor region="scrollContents"}}
|
||||
|
Loading…
Reference in New Issue
Block a user