2014-06-19 23:36:51 +08:00
|
|
|
# Publish only the users that are in the particular meetingId
|
|
|
|
# On the client side we pass the meetingId parameter
|
2014-10-30 04:40:39 +08:00
|
|
|
Meteor.publish 'users', (meetingId, userid) ->
|
2014-10-31 07:16:47 +08:00
|
|
|
console.log "publishing users for #{meetingId}, #{userid}"
|
2014-10-30 04:40:39 +08:00
|
|
|
|
2014-11-11 20:18:07 +08:00
|
|
|
Meteor.Users.find(
|
|
|
|
{meetingId: meetingId},
|
|
|
|
{fields:{
|
|
|
|
'userId': 0,
|
|
|
|
'user.userid': 0,
|
|
|
|
'user.extern_userid': 0,
|
|
|
|
'user.voiceUser.userid': 0,
|
|
|
|
'user.voiceUser.web_userid': 0}
|
2014-10-30 04:40:39 +08:00
|
|
|
})
|
2014-11-11 20:18:07 +08:00
|
|
|
|
2014-10-30 04:40:39 +08:00
|
|
|
|
2014-10-08 07:08:48 +08:00
|
|
|
Meteor.publish 'chat', (meetingId, userid) ->
|
2014-10-31 07:05:28 +08:00
|
|
|
console.log "publishing chat for #{meetingId} #{userid}"
|
2014-10-17 04:22:37 +08:00
|
|
|
me = Meteor.Users.findOne({meetingId: meetingId, userId: userid})
|
|
|
|
if me?
|
|
|
|
me = me._id
|
|
|
|
Meteor.Chat.find({$or: [
|
|
|
|
{'message.chat_type': 'PUBLIC_CHAT', 'meetingId': meetingId},
|
|
|
|
{'message.from_userid': me, 'meetingId': meetingId},
|
|
|
|
{'message.to_userid': me, 'meetingId': meetingId}
|
|
|
|
]})
|
2014-07-08 04:31:18 +08:00
|
|
|
|
|
|
|
Meteor.publish 'shapes', (meetingId) ->
|
|
|
|
Meteor.Shapes.find({meetingId: meetingId})
|
2014-07-08 04:58:50 +08:00
|
|
|
|
|
|
|
Meteor.publish 'slides', (meetingId) ->
|
|
|
|
Meteor.Slides.find({meetingId: meetingId})
|
|
|
|
|
2014-07-10 00:06:25 +08:00
|
|
|
Meteor.publish 'meetings', (meetingId) ->
|
|
|
|
Meteor.Meetings.find({meetingId: meetingId})
|
2014-07-28 23:00:07 +08:00
|
|
|
|
2014-07-30 04:57:02 +08:00
|
|
|
Meteor.publish 'presentations', (meetingId) ->
|
|
|
|
Meteor.Presentations.find({meetingId: meetingId})
|
|
|
|
|
2014-07-28 23:00:07 +08:00
|
|
|
# Clear all data in subcriptions
|
|
|
|
@clearCollections = ->
|
|
|
|
Meteor.Users.remove({})
|
|
|
|
console.log "cleared Users Collection!"
|
|
|
|
Meteor.Chat.remove({})
|
|
|
|
console.log "cleared Chat Collection!"
|
|
|
|
Meteor.Meetings.remove({})
|
|
|
|
console.log "cleared Meetings Collection!"
|
|
|
|
Meteor.Shapes.remove({})
|
|
|
|
console.log "cleared Shapes Collection!"
|
|
|
|
Meteor.Slides.remove({})
|
|
|
|
console.log "cleared Slides Collection!"
|
2014-07-30 04:57:02 +08:00
|
|
|
Meteor.Presentations.remove({})
|
|
|
|
console.log "cleared Presentations Collection!"
|