cleaning up
This commit is contained in:
parent
5554a0d6b1
commit
ca605e2e8c
@ -74,12 +74,10 @@ Meteor.startup ->
|
||||
|
||||
Meteor.autorun ->
|
||||
if Meteor.status().connected
|
||||
console.log("c0onnected")
|
||||
console.log("connected")
|
||||
uid = getInSession("userId")
|
||||
console.log uid
|
||||
# Obtain user info here. for testing. should be moved somewhere else later
|
||||
#Meteor.call "getMyInfo2", uid, ((result) -> console.log "resultaa")
|
||||
Meteor.call "getMyInfo2", uid, (error, result) ->
|
||||
Meteor.call "getMyInfo", uid, (error, result) ->
|
||||
if error? then console.log "error:" + error
|
||||
else
|
||||
console.log result
|
||||
@ -94,15 +92,6 @@ Meteor.startup ->
|
||||
Meteor.subscribe 'presentations', getInSession('meetingId'), ->
|
||||
Meteor.call('sendMeetingInfoToClient', getInSession('meetingId'), getInSession("userId")) # the dbid may have changed #TODO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#console.log "before, the users in the session are:" + grabAllDBID()
|
||||
#Meteor.subscribe 'users', getInSession('meetingId'), getInSession("userId"), ->
|
||||
# console.log "after, the users in the session are:" + grabAllDBID()
|
||||
|
||||
setInSession "display_usersList", true
|
||||
setInSession "display_navbar", true
|
||||
setInSession "display_chatbar", true
|
||||
|
@ -29,12 +29,9 @@
|
||||
path: "/"
|
||||
onBeforeAction: ->
|
||||
self = @
|
||||
#console.log "meetingId:" + getInSession 'meetingId'
|
||||
#console.log "userId:" + getInSession 'userId'
|
||||
Meteor.call('sendMeetingInfoToClient', getInSession('meetingId'),getInSession('userId'))
|
||||
# Have to check on the server whether the credentials the user has are valid on db, without being able to spam requests for credentials
|
||||
Meteor.subscribe 'users', getInSession('meetingId'), getInSession("userId"), -> # callback for after users have been loaded on client
|
||||
console.log "AA" + grabAllDBID()
|
||||
Meteor.subscribe 'chat', getInSession('meetingId'), getInSession("userId"), ->
|
||||
Meteor.subscribe 'shapes', getInSession('meetingId'), ->
|
||||
Meteor.subscribe 'slides', getInSession('meetingId'), ->
|
||||
@ -42,7 +39,7 @@
|
||||
Meteor.subscribe 'presentations', getInSession('meetingId'), ->
|
||||
Meteor.call('sendMeetingInfoToClient', getInSession('meetingId'), getInSession("userId")) # the dbid may have changed #TODO
|
||||
# Obtain user info here. for testing. should be moved somewhere else later
|
||||
Meteor.call "getMyInfo2", getInSession("userId"), (error, result) ->
|
||||
Meteor.call "getMyInfo", getInSession("userId"), (error, result) ->
|
||||
console.log "in router:" + JSON.stringify result
|
||||
setInSession("DBID", result.DBID)
|
||||
setInSession("userName", result.name)
|
||||
|
@ -1,10 +1,7 @@
|
||||
# Publish only the users that are in the particular meetingId
|
||||
# On the client side we pass the meetingId parameter
|
||||
Meteor.publish 'users', (meetingId, userid) ->
|
||||
array = []
|
||||
for u in Meteor.Users.find({'meetingId':meetingId}).fetch()
|
||||
array.push(u._id)
|
||||
console.log "publishing users for #{meetingId}, #{userid} " + array
|
||||
console.log "publishing users for #{meetingId}, #{userid}"
|
||||
|
||||
u = Meteor.Users.findOne({'userId': userid, 'meetingId': meetingId})
|
||||
if u?
|
||||
@ -52,7 +49,6 @@ Meteor.publish 'users', (meetingId, userid) ->
|
||||
if user?.user?.userid is userid
|
||||
console.log "finally user with id:#{userid} joined:" + Meteor.Users.findOne({'meetingId':meetingId, 'userId': userid})._id
|
||||
self.added('users', id, user)
|
||||
#return Meteor.Users.find({meetingId: meetingId}, {fields: { 'userId': 0, 'user.userid': 0, 'user.extern_userid': 0, 'user.voiceUser.userid': 0, 'user.voiceUser.web_userid': 0 }})
|
||||
})
|
||||
self.ready()
|
||||
self.onStop(->handle.stop())
|
||||
@ -69,19 +65,15 @@ Meteor.publish 'chat', (meetingId, userid) ->
|
||||
]})
|
||||
|
||||
Meteor.publish 'shapes', (meetingId) ->
|
||||
console.log "publishing shapes for #{meetingId}"
|
||||
Meteor.Shapes.find({meetingId: meetingId})
|
||||
|
||||
Meteor.publish 'slides', (meetingId) ->
|
||||
console.log "publishing slides for #{meetingId}"
|
||||
Meteor.Slides.find({meetingId: meetingId})
|
||||
|
||||
Meteor.publish 'meetings', (meetingId) ->
|
||||
console.log "publishing meetings for #{meetingId}"
|
||||
Meteor.Meetings.find({meetingId: meetingId})
|
||||
|
||||
Meteor.publish 'presentations', (meetingId) ->
|
||||
console.log "publishing presentations for #{meetingId}"
|
||||
Meteor.Presentations.find({meetingId: meetingId})
|
||||
|
||||
# Clear all data in subcriptions
|
||||
|
@ -16,20 +16,12 @@ Meteor.methods
|
||||
# be much, much better than the user passing in the first part of their
|
||||
# credentials and us looking up and suplying them with the second part.
|
||||
# It'd be much more secure.
|
||||
#getMyInfo: (uId) ->
|
||||
# u = Meteor.Users.findOne("userId": uId)
|
||||
# if u?
|
||||
# console.log "__server::getMyInfo " + u.userId + " DBID:" + u._id + " name:" + u.user.name
|
||||
# return {userId: u.userId, DBID: u._id, name: u.user.name}
|
||||
|
||||
getMyInfo2: (uId) ->
|
||||
getMyInfo: (uId) ->
|
||||
u = Meteor.Users.findOne("userId": uId)
|
||||
if u?
|
||||
console.log "__2server::getMyInfo " + u.userId + " DBID:" + u._id + " name:" + u.user.name
|
||||
return ({userId: u.userId, DBID: u._id, name: u.user.name})
|
||||
else
|
||||
console.log "there was no such user #{uId}"
|
||||
|
||||
console.log "__server::getMyInfo " + u.userId + " DBID:" + u._id + " name:" + u.user.name
|
||||
return {userId: u.userId, DBID: u._id, name: u.user.name}
|
||||
|
||||
Meteor.startup ->
|
||||
console.log "server start"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user