Skip to content
Snippets Groups Projects
Commit 639aa76d authored by Rodrigo Nascimento's avatar Rodrigo Nascimento
Browse files

Direct messages working

parent 5d1e2877
No related branches found
No related tags found
No related merge requests found
......@@ -153,7 +153,7 @@
{{#with userData}}
<div class="about cf_">
<div class="thumb">
{{> avatar userId=uid}}
{{> avatar username=username}}
</div>
<div class="info">
<h3>{{username}}</h3>
......
Meteor.methods
createDirectRoom: (toUserId) ->
createDirectRoom: (toUsername) ->
fromId = Meteor.userId()
# console.log '[methods] createDirectRoom -> '.green, 'fromId:', fromId, 'toUserId:', toUserId
if Meteor.userId() is toUserId
if Meteor.user().username is toUsername
return
roomId = [Meteor.userId(), toUserId].sort().join('')
roomId = [Meteor.userId().username, toUsername].sort().join('')
userTo = Meteor.users.findOne { _id: toUserId }
userTo = Meteor.users.findOne { username: toUsername }
me = Meteor.user()
......@@ -17,7 +17,7 @@ Meteor.methods
# create new room
ChatRoom.upsert { _id: roomId },
$set:
uids: [Meteor.userId(),toUserId]
usernames: [Meteor.user().username, toUsername]
$setOnInsert:
t: 'd'
name: "#{me.name}|#{userTo.name}"
......
......@@ -13,5 +13,6 @@ Meteor.startup ->
verified: true
],
name: 'Admin'
avatarOrigin: 'none'
Accounts.setPassword id, 'admin'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment