bigbluebutton-Github/labs/meteor-client/app/server/publish.coffee

54 lines
1.7 KiB
CoffeeScript
Raw Normal View History

# Publish only the users that are in the particular meetingId
# On the client side we pass the meetingId parameter
Meteor.publish 'users', (meetingId, userid) ->
2014-10-31 07:16:47 +08:00
console.log "publishing users for #{meetingId}, #{userid}"
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-08 07:08:48 +08:00
Meteor.publish 'chat', (meetingId, userid) ->
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}
]})
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})
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!"