Working on deleting conversations.

This commit is contained in:
perroned 2014-10-21 11:11:22 -07:00
parent 3d059e833d
commit 142d78ffb4
2 changed files with 5 additions and 14 deletions

View File

@ -2,12 +2,7 @@
<div id="{{id}}" {{visibility name}} class="component">
<div id="chatbar-contents">
<h3 class="title gradientBar"><span class="glyphicon glyphicon-comment"></span> {{title}}</h3>
<!-- ==================================================================================== -->
<!-- <div style="overflow-y: scroll; height:40px">{{>tabButtons}}</div> -->
{{>tabButtons}}
<!-- ==================================================================================== -->
{{>tabButtons}} <!-- Display public/options tabs, and private chat tabs -->
{{#if getInSession "display_chatPane"}}
<div id="chatbody">
<ul class="chat">
@ -112,16 +107,9 @@
<!-- Display buttons on the chat tab, public, options, and all the private chat tabs -->
<template name="tabButtons">
<!-- <ul id="tabButtonContainer" class="nav nav-tabs"> -->
<!-- {{#each grabChatTabs}} -->
<!-- {{{makeTabButton}}} -->
<!-- {{/each}} -->
<!-- </ul> -->
<ul id="tabsList" class="nav nav-tabs">
{{#each grabChatTabs}}
{{{makeTabButton}}}
{{/each}}
</ul>
</template>

View File

@ -40,11 +40,14 @@ Meteor.methods
deletePrivateChatMessages: (userId, contact_id) ->
# if authorized pass through
deletePrivateChatMessages(userId, contact_id)
requester = Meteor.Users.findOne({userId: userId})
contact = Meteor.Users.findOne({_id: contact_id})
deletePrivateChatMessages(requester.userId, contact.userId)
# --------------------------------------------------------------------------------------------
# Private methods on server
# --------------------------------------------------------------------------------------------
@deletePrivateChatMessages = (user1Id, user2Id) ->
console.log "Deleting messages between #{user1Id} & #{user2Id}"
Meteor.Chat.remove({ # find all and remove private messages between the 2 users
'message.chat_type': 'PRIVATE_CHAT',
$or: [{'message.from_userid': user1Id, 'message.to_userid': user2Id},{'message.from_userid': user2Id, 'message.to_userid': user1Id}]