use userId instead of the changing dbid

This commit is contained in:
Anton Georgiev 2014-11-21 17:28:50 +00:00
parent a2bbc548f0
commit 624354e246
3 changed files with 37 additions and 37 deletions

View File

@ -25,7 +25,7 @@
# retrieve account for selected user
@getCurrentUserFromSession = ->
Meteor.Users.findOne("_id": getInSession("userId"))
Meteor.Users.findOne(userId: getInSession("userId"))
@getInSession = (k) -> SessionAmplify.get k
@ -43,7 +43,7 @@
(new Date).valueOf()
@getTimeOfJoining = ->
Meteor.Users.findOne(_id: getInSession "DBID")?.user?.time_of_joining
Meteor.Users.findOne(userId: getInSession "userId")?.user?.time_of_joining
@getPresentationFilename = ->
currentPresentation = Meteor.Presentations.findOne({"presentation.current": true})
@ -111,21 +111,21 @@ Handlebars.registerHelper "isCurrentUserTalking", ->
Handlebars.registerHelper "isDisconnected", ->
return !Meteor.status().connected
Handlebars.registerHelper "isUserListenOnly", (_id) ->
user = Meteor.Users.findOne({_id:_id})
Handlebars.registerHelper "isUserListenOnly", (userId) ->
user = Meteor.Users.findOne({userId:userId})
return user?.user?.listenOnly
Handlebars.registerHelper "isUserMuted", (_id) ->
BBB.isUserMuted(_id)
Handlebars.registerHelper "isUserMuted", (userId) ->
BBB.isUserMuted(userId)
Handlebars.registerHelper "isUserSharingAudio", (_id) ->
BBB.isUserSharingAudio(_id)
Handlebars.registerHelper "isUserSharingAudio", (userId) ->
BBB.isUserSharingAudio(userId)
Handlebars.registerHelper "isUserSharingVideo", (_id) ->
BBB.isUserSharingWebcam(_id)
Handlebars.registerHelper "isUserSharingVideo", (userId) ->
BBB.isUserSharingWebcam(userId)
Handlebars.registerHelper "isUserTalking", (_id) ->
BBB.isUserTalking(_id)
Handlebars.registerHelper "isUserTalking", (userId) ->
BBB.isUserTalking(userId)
Handlebars.registerHelper "meetingIsRecording", ->
Meteor.Meetings.findOne()?.recorded # Should only ever have one meeting, so we dont need any filter and can trust result #1
@ -154,7 +154,7 @@ Handlebars.registerHelper "visibility", (section) ->
style: 'display:none'
@isSharingAudio = ->
return Meteor.Users.findOne({_id: getInSession "DBID"})?.user?.voiceUser?.joined
return Meteor.Users.findOne({userId: getInSession "userId"})?.user?.voiceUser?.joined
# transform plain text links into HTML tags compatible with Flash client
@linkify = (str) ->
@ -208,7 +208,7 @@ Handlebars.registerHelper "visibility", (section) ->
setInSession "display_chatbar", !getInSession "display_chatbar"
@toggleMic = (event) ->
u = Meteor.Users.findOne({_id:getInSession("DBID")})
u = Meteor.Users.findOne({userId:getInSession("userId")})
if u?
Meteor.call('muteUser', getInSession("meetingId"), u.userId, getInSession("userId"), getInSession("userSecret"), not u.user.voiceUser.muted)
@ -266,7 +266,7 @@ Handlebars.registerHelper "visibility", (section) ->
# TODO TEMPORARY!!
# must not have this in production
@whoami = ->
return {
console.log JSON.stringify {
username: getInSession "userName"
userid: getInSession "userId"
userSecret: getInSession "userSecret"

View File

@ -26,11 +26,11 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
###
Queryies the user object via it's id
###
BBB.getUser = (_id) ->
Meteor.Users.findOne({_id: _id})
BBB.getUser = (userId) ->
Meteor.Users.findOne({userId: userId})
BBB.getCurrentUser = () ->
BBB.getUser(getInSession("DBID"))
BBB.getUser(getInSession("userId"))
###
Query if the current user is sharing webcam.
@ -42,7 +42,7 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
for AM_I_SHARING_CAM_RESP (see below).
###
BBB.amISharingWebcam = (callback) ->
BBB.isUserSharingWebcam BBB.getCurrentUser()?._id
BBB.isUserSharingWebcam BBB.getCurrentUser()?.userId
###
@ -54,20 +54,20 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
if you want to be informed through an event. You have to register for
IS_USER_PUBLISHING_CAM_RESP (see below).
###
BBB.isUserSharingWebcam = (_id, callback) ->
BBB.getUser(_id)?.user?.webcam_stream?.length isnt 0
BBB.isUserSharingWebcam = (userId, callback) ->
BBB.getUser(userId)?.user?.webcam_stream?.length isnt 0
BBB.amITalking = (callback) ->
BBB.isUserTalking BBB.getCurrentUser()?._id
BBB.isUserTalking BBB.getCurrentUser()?.userId
BBB.isUserTalking = (_id, callback) ->
BBB.getUser(_id)?.user?.voiceUser?.talking
BBB.isUserTalking = (userId, callback) ->
BBB.getUser(userId)?.user?.voiceUser?.talking
BBB.amISharingAudio = (callback) ->
BBB.isUserSharingAudio BBB.getCurrentUser()?._id
BBB.isUserSharingAudio BBB.getCurrentUser()?.userId
BBB.isUserSharingAudio = (_id) ->
BBB.getUser(_id)?.user?.voiceUser?.joined
BBB.isUserSharingAudio = (userId) ->
BBB.getUser(userId)?.user?.voiceUser?.joined
###
Raise user's hand.
@ -141,7 +141,7 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
user = BBB.getCurrentUser()
if user?
name = BBB.getUserName(user._id)
name = BBB.getUserName(user.userId)
setInSession "userName", name # store in session for fast access next time
name
@ -149,8 +149,8 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
res = Meteor.Meetings.findOne({}).voiceConf
returnOrCallback res, callback
BBB.getUserName = (_id, callback) ->
returnOrCallback BBB.getUser(_id)?.user?.name, callback
BBB.getUserName = (userId, callback) ->
returnOrCallback BBB.getUser(userId)?.user?.name, callback
###
Query the current user's role.
@ -215,7 +215,7 @@ https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
Indicates if the current user is muted
###
BBB.amIMuted = ->
BBB.isUserMuted(BBB.getCurrentUser()._id)
BBB.isUserMuted(BBB.getCurrentUser().userId)
###
Mute the current user.

View File

@ -1,12 +1,12 @@
<template name="displayUserIcons">
<td>{{#if isUserSharingVideo _id}}
<td>{{#if isUserSharingVideo userId}}
<span class="userListSettingIcon glyphicon glyphicon-facetime-video" rel="tooltip" data-placement="bottom" title="{{user.name}} is sharing their webcam"></span>
{{/if}}</td>
<!-- Should use much more noticeable icons than just bootstrap's volume-up & volume-down to differentiate talking but it is good for now -->
<td>{{#if isUserSharingAudio _id}}
<td>{{#if isUserSharingAudio userId}}
{{#if isCurrentUser userId}}
{{#if isUserMuted _id}}
{{#if isUserMuted userId}}
<span class="muteIcon userListSettingIcon glyphicon glyphicon-volume-off" rel="tooltip" data-placement="bottom" title="Unmute yourself"></span>
{{else}}
{{#if isCurrentUserTalking}}
@ -16,10 +16,10 @@
{{/if}}
{{/if}}
{{else}}
{{#if isUserMuted _id}}
{{#if isUserMuted userId}}
<span class="userListSettingIcon glyphicon glyphicon-volume-off" rel="tooltip" data-placement="bottom" title="{{user.name}} is muted"></span>
{{else}}
{{#if isUserTalking _id}}
{{#if isUserTalking userId}}
<span class="userListSettingIcon glyphicon glyphicon-volume-up" rel="tooltip" data-placement="bottom" title="{{user.name}} is talking"></span>
{{else}}
<span class="userListSettingIcon glyphicon glyphicon-volume-down" rel="tooltip" data-placement="bottom" title="{{user.name}} is not talking"></span>
@ -28,7 +28,7 @@
{{/if}}
{{/if}}
<!-- listen only: -->
{{#if isUserListenOnly _id}}
{{#if isUserListenOnly userId}}
<span class="userListSettingIcon glyphicon glyphicon-headphones" title="Listening only"></span>
{{/if}}
</td>