separate collections definitions between server and client

pull/176/head
Gabriel Engel 10 years ago
parent dc9c7cb7f6
commit b169e70f9d
  1. 20
      client/lib/collections.coffee
  2. 0
      server/lib/collections.coffee

@ -1,6 +1,25 @@
@UserFullName = {}
@UserAndRoom = new Meteor.Collection null
@ChatMessageHistory = new Meteor.Collection null
@ChatRoom = new Meteor.Collection 'data.ChatRoom'
@ChatSubscription = new Meteor.Collection 'data.ChatSubscription'
@ChatMessage = new Meteor.Collection 'data.ChatMessage'
# ,
# transform: (room) ->
# if room.t is 'd' and Meteor.userId()?
# if not UserFullName[Meteor.userId()]?
# user = Meteor.users.findOne Meteor.userId()
# UserFullName[Meteor.userId()] = user.name
# regex = new RegExp('\\|?' + UserFullName[Meteor.userId()] + '\\|?')
# room.name = room.name.replace(regex, '')
# return room
Meteor.startup ->
ChatMessage.find().observe
added: (record) ->
@ -10,3 +29,4 @@ Meteor.startup ->
removed: (record) ->
if ChatRoom._collection._docs._map[record.rid]? and not ChatMessageHistory._collection._docs._map[record._id]?
ChatMessageHistory.insert record

Loading…
Cancel
Save