Created a new collection named Polls, able to catch a message and save it there

This commit is contained in:
Oleksandr Zhurbenko 2015-07-21 16:55:42 -07:00
parent 922283ce2e
commit fbdc50281c
6 changed files with 24 additions and 3 deletions

View File

@ -4,5 +4,6 @@ Meteor.Meetings = new Meteor.Collection("meetings")
Meteor.Presentations = new Meteor.Collection("presentations")
Meteor.Shapes = new Meteor.Collection("shapes")
Meteor.Slides = new Meteor.Collection("slides")
Meteor.Polls = new Meteor.Collection("bbb_pool")
Meteor.WhiteboardCleanStatus = new Meteor.Collection("whiteboard-clean-status")

View File

@ -56,6 +56,7 @@
Meteor.subscribe 'presentations', meetingId, onReady: =>
Meteor.subscribe 'users', meetingId, userId, authToken, onError: onErrorFunction, onReady: =>
Meteor.subscribe 'whiteboard-clean-status', meetingId, onReady: =>
Meteor.subscribe 'bbb_poll', meetingId, userId, authToken, onReady: =>
# done subscribing
onLoadComplete()

View File

@ -56,6 +56,14 @@ Meteor.publish 'chat', (meetingId, userid, authToken) ->
@error new Meteor.Error(402, "The user was not authorized to subscribe for 'chats'")
return
Meteor.publish 'bbb_poll', (meetingId, userid, authToken) ->
if isAllowedTo('subscribePoll', meetingId, userid, authToken)
Meteor.log.info "publishing Poll for #{meetingId} #{userid} #{authToken}"
return Meteor.Polls.find()
else
@error new Meteor.Error(402, "The user was not authorized to subscribe for 'bbb_poll'")
return
Meteor.publish 'shapes', (meetingId) ->
Meteor.Shapes.find({meetingId: meetingId})

View File

@ -335,6 +335,9 @@ class Meteor.RedisPubSub
removeMeetingFromCollection meetingId
return
if message.header.name is "poll_started_message"
addPollToCollection message.payload
# --------------------------------------------------------------------------------------------
# Private methods on server
# --------------------------------------------------------------------------------------------

View File

@ -9,7 +9,8 @@ Meteor.startup ->
clearShapesCollection()
clearSlidesCollection()
clearPresentationsCollection()
clearPollCollection()
# create create a PubSub connection, start listening
Meteor.redisPubSub = new Meteor.RedisPubSub(->
Meteor.log.info "created pubsub")

View File

@ -2,6 +2,9 @@
presenter =
switchSlide: true
#poll
subscribePoll: true
# holds the values for whether the moderator user is allowed to perform an action (true)
# or false if not allowed. Some actions have dynamic values depending on the current lock settings
moderator =
@ -30,6 +33,9 @@ moderator =
chatPublic: true
chatPrivate: true
#poll
subscribePoll: true
# holds the values for whether the viewer user is allowed to perform an action (true)
# or false if not allowed. Some actions have dynamic values depending on the current lock settings
@ -64,8 +70,9 @@ viewer = (meetingId, userId) ->
chatPrivate: !(Meteor.Meetings.findOne({meetingId:meetingId})?.roomLockSettings.disablePrivChat) or
!(Meteor.Users.findOne({meetingId:meetingId, userId:userId})?.user.locked) or
Meteor.Users.findOne({meetingId:meetingId, userId:userId})?.user.presenter
#poll
subscribePoll: true
# carries out the decision making for actions affecting users. For the list of
# actions and the default value - see 'viewer' and 'moderator' in the beginning of the file