Only send initial message once

This commit is contained in:
perroned 2014-08-13 12:16:27 -07:00
parent b830735e08
commit 9a2990fe4a
2 changed files with 18 additions and 17 deletions

View File

@ -84,11 +84,13 @@ 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
me = getInSession("userId")
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": getInSession("userId")
"from_userid": me
"from_username": getUsersName()
"from_tz_offset": "240"
"to_username": @user.name
@ -96,7 +98,6 @@ Template.optionsBar.events
"from_lang": "en"
"from_time": getTime()
"from_color": "0"
Meteor.call "sendChatMessagetoServer", getInSession("meetingId"), messageForServer
Template.tabButtons.events

View File

@ -37,7 +37,7 @@
<!-- Displays the list of options available -->
<template name="optionsBar">
<p>Select a person to chat with privately</p>
<p>&nbsp;&nbsp;Select a person to chat with privately</p>
<div class="private-chat-user-box">
{{#Layout template="scrollWindow" id="privateChatUserScrollWindow"}}
{{#contentFor region="scrollContents"}}