From 9d42ca9bd77e660a1ef532d88b2c6cebf1b02976 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 1 Aug 2017 10:10:12 -0300 Subject: [PATCH] Move from users to voice-users --- .../api/2.0/users/server/modifiers/addUser.js | 24 ++++++----- .../2.0/users/server/modifiers/removeUser.js | 9 +---- .../users/server/modifiers/updateVoiceUser.js | 34 ---------------- .../imports/api/2.0/voice-user/index.js | 1 - .../2.0/voice-user/server/eventHandlers.js | 10 ----- .../server/handlers/joinVoiceUser.js | 11 ----- .../server/handlers/leftVoiceUser.js | 11 ----- .../server/handlers/mutedVoiceUser.js | 11 ----- .../server/handlers/talkingVoiceUser.js | 11 ----- .../api/2.0/voice-user/server/index.js | 2 - .../server/modifiers/addVoiceUser.js | 40 ------------------- .../server/modifiers/removeVoiceUser.js | 15 ------- .../server/modifiers/updateVoiceUser.js | 36 ----------------- .../api/2.0/voice-user/server/publishers.js | 23 ----------- .../server/modifiers/addVoiceUser.js | 19 +++++---- .../server/modifiers/removeVoiceUser.js | 26 ++++++++++-- .../server/modifiers/updateVoiceUser.js | 5 ++- .../api/2.0/voice-users/server/publishers.js | 4 +- .../imports/startup/client/base.jsx | 4 +- .../actions-bar/mute-button/container.jsx | 30 +++++--------- .../components/audio/audio-menu/container.jsx | 20 ++++------ .../imports/ui/components/chat/service.js | 23 +---------- .../ui/components/user-list/service.js | 25 +----------- .../imports/ui/services/user/mapUser.js | 35 ++++++++++++++++ .../private/config/public/acl.yaml | 2 +- bigbluebutton-html5/server/main.js | 2 +- 26 files changed, 115 insertions(+), 318 deletions(-) delete mode 100755 bigbluebutton-html5/imports/api/2.0/users/server/modifiers/updateVoiceUser.js delete mode 100755 bigbluebutton-html5/imports/api/2.0/voice-user/index.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/eventHandlers.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/joinVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/leftVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/mutedVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/talkingVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/index.js delete mode 100755 bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/addVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/removeVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/updateVoiceUser.js delete mode 100644 bigbluebutton-html5/imports/api/2.0/voice-user/server/publishers.js create mode 100644 bigbluebutton-html5/imports/ui/services/user/mapUser.js diff --git a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/addUser.js b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/addUser.js index 4b6fded4ae..dacf37bbc0 100644 --- a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/addUser.js +++ b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/addUser.js @@ -1,6 +1,7 @@ import { check } from 'meteor/check'; import Logger from '/imports/startup/server/logger'; import Users from '/imports/api/2.0/users'; +import addVoiceUser from '/imports/api/2.0/voice-users/server/modifiers/addVoiceUser'; export default function addUser(meetingId, user) { check(user, Object); @@ -58,20 +59,21 @@ export default function addUser(meetingId, user) { 'user.presenter': user.presenter, 'user.locked': user.locked, 'user.listenOnly': user.listenOnly, - - // default values for voiceUser and webcam - 'user.webcam_stream': [], - 'user.voiceUser.web_userid': false, - 'user.voiceUser.callernum': false, - 'user.voiceUser.userid': false, - 'user.voiceUser.talking': false, - 'user.voiceUser.joined': false, - 'user.voiceUser.callername': false, - 'user.voiceUser.locked': false, - 'user.voiceUser.muted': false, }, }; + addVoiceUser(meetingId, { + voiceUserId: '', + intId: userId, + callerName: user.name, + callerNum: '', + muted: false, + talking: false, + callingWith: '', + listenOnly: false, + voiceConf: '', + }); + const cb = (err, numChanged) => { if (err) { return Logger.error(`Adding user to collection: ${err}`); diff --git a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/removeUser.js b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/removeUser.js index 6f5596b74c..e058615ba9 100644 --- a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/removeUser.js +++ b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/removeUser.js @@ -16,9 +16,6 @@ export default function removeUser(meetingId, userId) { const modifier = { $set: { 'user.connection_status': 'offline', - 'user.voiceUser.talking': false, - 'user.voiceUser.joined': false, - 'user.voiceUser.muted': false, 'user.time_of_joining': 0, 'user.listenOnly': false, 'user.validated': false, @@ -28,14 +25,12 @@ export default function removeUser(meetingId, userId) { }, }; - const cb = (err, numChanged) => { + const cb = (err) => { if (err) { return Logger.error(`Removing user from collection: ${err}`); } - if (numChanged) { - return Logger.info(`Removed ${CLIENT_TYPE_HTML} user id=${userId} meeting=${meetingId}`); - } + return Logger.info(`Removed ${CLIENT_TYPE_HTML} user id=${userId} meeting=${meetingId}`); }; return Users.update(selector, modifier, cb); diff --git a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/updateVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/updateVoiceUser.js deleted file mode 100755 index d166fca0b2..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/users/server/modifiers/updateVoiceUser.js +++ /dev/null @@ -1,34 +0,0 @@ -import { check } from 'meteor/check'; -import Logger from '/imports/startup/server/logger'; -import Users from '/imports/api/2.0/users'; - -export default function updateVoiceUser(meetingId, voiceUser) { - check(meetingId, String); - check(voiceUser, Object); - - const selector = { - meetingId, - user: voiceUser.intId, - }; - - const modifier = { - $set: { - 'user.voiceUser.talking': voiceUser.talking, - 'user.voiceUser.joined': voiceUser.joined, - 'user.voiceUser.locked': voiceUser.locked, - 'user.voiceUser.muted': voiceUser.muted, - }, - }; - - const cb = (err, numChanged) => { - if (err) { - return Logger.error(`Updating voice user=${voiceUser.intId}: ${err}`); - } - - if (numChanged) { - return Logger.verbose(`Updated voice user=${voiceUser.intId} meeting=${meetingId}`); - } - }; - - return Users.update(selector, modifier, cb); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/index.js b/bigbluebutton-html5/imports/api/2.0/voice-user/index.js deleted file mode 100755 index a8db0b7104..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/index.js +++ /dev/null @@ -1 +0,0 @@ -export default new Mongo.Collection('voiceUser'); diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/eventHandlers.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/eventHandlers.js deleted file mode 100644 index c1e9452cb6..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/eventHandlers.js +++ /dev/null @@ -1,10 +0,0 @@ -import RedisPubSub from '/imports/startup/server/redis2x'; -import handleJoinVoiceUser from './handlers/joinVoiceUser'; -import handleLeftVoiceUser from './handlers/leftVoiceUser'; -import handleTalkingVoiceUser from './handlers/talkingVoiceUser'; -import handleMutedVoiceUser from './handlers/mutedVoiceUser'; - -RedisPubSub.on('UserLeftVoiceConfToClientEvtMsg', handleLeftVoiceUser); -RedisPubSub.on('UserJoinedVoiceConfToClientEvtMsg', handleJoinVoiceUser); -RedisPubSub.on('UserTalkingVoiceEvtMsg', handleTalkingVoiceUser); -RedisPubSub.on('UserMutedVoiceEvtMsg', handleMutedVoiceUser); diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/joinVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/joinVoiceUser.js deleted file mode 100644 index 73d014c58c..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/joinVoiceUser.js +++ /dev/null @@ -1,11 +0,0 @@ -import { check } from 'meteor/check'; - -import addVoiceUser from '../modifiers/addVoiceUser'; - -export default function handleJoinVoiceUser({ body }, meetingId) { - const voiceUser = body; - - check(meetingId, String); - - return addVoiceUser(meetingId, voiceUser); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/leftVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/leftVoiceUser.js deleted file mode 100644 index e2e4baaa15..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/leftVoiceUser.js +++ /dev/null @@ -1,11 +0,0 @@ -import { check } from 'meteor/check'; - -import removeVoiceUser from '../modifiers/removeVoiceUser'; - -export default function handleVoiceUpdate({ body }, meetingId) { - const voiceUser = body; - - check(meetingId, String); - - return removeVoiceUser(meetingId, voiceUser); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/mutedVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/mutedVoiceUser.js deleted file mode 100644 index 144a217188..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/mutedVoiceUser.js +++ /dev/null @@ -1,11 +0,0 @@ -import { check } from 'meteor/check'; - -import updateVoiceUser from '../modifiers/updateVoiceUser'; - -export default function handleVoiceUpdate({ body }, meetingId) { - const voiceUser = body; - - check(meetingId, String); - - return updateVoiceUser(meetingId, voiceUser); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/talkingVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/talkingVoiceUser.js deleted file mode 100644 index 144a217188..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/handlers/talkingVoiceUser.js +++ /dev/null @@ -1,11 +0,0 @@ -import { check } from 'meteor/check'; - -import updateVoiceUser from '../modifiers/updateVoiceUser'; - -export default function handleVoiceUpdate({ body }, meetingId) { - const voiceUser = body; - - check(meetingId, String); - - return updateVoiceUser(meetingId, voiceUser); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/index.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/index.js deleted file mode 100644 index f993f38e5b..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/index.js +++ /dev/null @@ -1,2 +0,0 @@ -import './eventHandlers'; -import './publishers'; diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/addVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/addVoiceUser.js deleted file mode 100755 index dc7d994d47..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/addVoiceUser.js +++ /dev/null @@ -1,40 +0,0 @@ -import { check } from 'meteor/check'; -import Logger from '/imports/startup/server/logger'; -import VoiceUser from '/imports/api/2.0/voice-user'; -import flat from 'flat'; - -export default function addVoiceUser(meetingId, voiceUser) { - check(meetingId, String); - check(voiceUser, { - voiceConf: String, - voiceUserId: String, - intId: String, - callerIdName: String, - callerIdNum: String, - muted: Boolean, - talking: Boolean, - callingWith: String, - }); - - const selector = { - meetingId, - intId: voiceUser.intId, - }; - - const modifier = { - $set: Object.assign( - { meetingId }, - flat(voiceUser), - ), - }; - - const cb = (err) => { - if (err) { - return Logger.error(`Add voice user=${voiceUser.intId}: ${err}`); - } - - return Logger.verbose(`Add voice user=${voiceUser.intId} meeting=${meetingId}`); - }; - - return VoiceUser.update(selector, modifier, cb); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/removeVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/removeVoiceUser.js deleted file mode 100644 index a5d99969df..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/removeVoiceUser.js +++ /dev/null @@ -1,15 +0,0 @@ -import { check } from 'meteor/check'; -import Logger from '/imports/startup/server/logger'; -import VoiceUser from '/imports/api/2.0/voice-user'; - -export default function removeVoiceUser(meetingId, voiceUser) { - check(meetingId, String); - check(voiceUser, { - voiceConf: String, - voiceUserId: String, - }); - - const { voiceConf, voiceUserId } = voiceUser; - - return VoiceUser.remove({ meetingId, voiceConf, voiceUserId }, Logger.info(`Remove VoiceUser voiceUserId=${voiceUserId} meetingId=${meetingId}`)); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/updateVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/updateVoiceUser.js deleted file mode 100644 index cf0def4800..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/modifiers/updateVoiceUser.js +++ /dev/null @@ -1,36 +0,0 @@ -import { Match, check } from 'meteor/check'; -import Logger from '/imports/startup/server/logger'; -import VoiceUser from '/imports/api/2.0/voice-user'; -import flat from 'flat'; - -export default function removeVoiceUser(meetingId, voiceUser) { - check(meetingId, String); - check(voiceUser, { - intId: String, - voiceUserId: String, - talking: Match.Maybe(Boolean), - muted: Match.Maybe(Boolean), - }); - - const selector = { - meetingId, - intId: voiceUser.intId, - }; - - const modifier = { - $set: Object.assign( - { meetingId }, - flat(voiceUser), - ), - }; - - const cb = (err) => { - if (err) { - return Logger.error(`Add voice user=${voiceUser.intId}: ${err}`); - } - - return Logger.verbose(`Add voice user=${voiceUser.intId} meeting=${meetingId}`); - }; - - return VoiceUser.update(selector, modifier, cb); -} diff --git a/bigbluebutton-html5/imports/api/2.0/voice-user/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/voice-user/server/publishers.js deleted file mode 100644 index e4ae08b4e4..0000000000 --- a/bigbluebutton-html5/imports/api/2.0/voice-user/server/publishers.js +++ /dev/null @@ -1,23 +0,0 @@ -import VoiceUser from '/imports/api/2.0/voice-user'; -import { Meteor } from 'meteor/meteor'; -import { check } from 'meteor/check'; -import Logger from '/imports/startup/server/logger'; -import mapToAcl from '/imports/startup/mapToAcl'; - -function voiceUser(credentials) { - const { meetingId, requesterUserId } = credentials; - - check(meetingId, String); - check(requesterUserId, String); - - Logger.info(`Publishing Voice User for ${meetingId} ${requesterUserId}`); - - return VoiceUser.find({ meetingId }); -} - -function publish(...args) { - const boundVoiceUser = voiceUser.bind(this); - return mapToAcl('subscriptions.voiceUser', boundVoiceUser)(args); -} - -Meteor.publish('voiceUser', publish); diff --git a/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/addVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/addVoiceUser.js index 48f0942240..47b456cfcb 100755 --- a/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/addVoiceUser.js +++ b/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/addVoiceUser.js @@ -1,24 +1,27 @@ import { check } from 'meteor/check'; import Logger from '/imports/startup/server/logger'; -import VoiceUser from '/imports/api/2.0/voice-users'; +import VoiceUsers from '/imports/api/2.0/voice-users'; import flat from 'flat'; export default function addVoiceUser(meetingId, voiceUser) { check(meetingId, String); check(voiceUser, { - voiceConf: String, voiceUserId: String, intId: String, - callerIdName: String, - callerIdNum: String, + callerName: String, + callerNum: String, muted: Boolean, talking: Boolean, callingWith: String, + listenOnly: Boolean, + voiceConf: String, }); + const { intId } = voiceUser; + const selector = { meetingId, - intId: voiceUser.intId, + intId, }; const modifier = { @@ -30,11 +33,11 @@ export default function addVoiceUser(meetingId, voiceUser) { const cb = (err) => { if (err) { - return Logger.error(`Add voice user=${voiceUser.intId}: ${err}`); + return Logger.error(`Add voice user=${intId}: ${err}`); } - return Logger.verbose(`Add voice user=${voiceUser.intId} meeting=${meetingId}`); + return Logger.verbose(`Add voice user=${intId} meeting=${meetingId}`); }; - return VoiceUser.update(selector, modifier, cb); + return VoiceUsers.upsert(selector, modifier, cb); } diff --git a/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/removeVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/removeVoiceUser.js index 3be92ca2c2..ff34aaeee6 100644 --- a/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/removeVoiceUser.js +++ b/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/removeVoiceUser.js @@ -1,15 +1,35 @@ import { check } from 'meteor/check'; import Logger from '/imports/startup/server/logger'; -import VoiceUser from '/imports/api/2.0/voice-users'; +import VoiceUsers from '/imports/api/2.0/voice-users'; export default function removeVoiceUser(meetingId, voiceUser) { check(meetingId, String); check(voiceUser, { voiceConf: String, voiceUserId: String, + intId: String, }); - const { voiceConf, voiceUserId } = voiceUser; + const { intId } = voiceUser; - return VoiceUser.remove({ meetingId, voiceConf, voiceUserId }, Logger.info(`Remove VoiceUser voiceUserId=${voiceUserId} meetingId=${meetingId}`)); + const selector = { + meetingId, + intId, + }; + + const modifier = { + muted: false, + talking: false, + listenOnly: false, + }; + + const cb = (err) => { + if (err) { + return Logger.error(`Add voice user=${intId}: ${err}`); + } + + return Logger.verbose(`Add voice user=${intId} meeting=${meetingId}`); + }; + + return VoiceUsers.update(selector, modifier, cb); } diff --git a/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/updateVoiceUser.js b/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/updateVoiceUser.js index 80e8120ec4..9226467ae1 100644 --- a/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/updateVoiceUser.js +++ b/bigbluebutton-html5/imports/api/2.0/voice-users/server/modifiers/updateVoiceUser.js @@ -1,6 +1,6 @@ import { Match, check } from 'meteor/check'; import Logger from '/imports/startup/server/logger'; -import VoiceUser from '/imports/api/2.0/voice-users'; +import VoiceUsers from '/imports/api/2.0/voice-users'; import flat from 'flat'; export default function removeVoiceUser(meetingId, voiceUser) { @@ -10,6 +10,7 @@ export default function removeVoiceUser(meetingId, voiceUser) { voiceUserId: String, talking: Match.Maybe(Boolean), muted: Match.Maybe(Boolean), + voiceConf: String, }); const selector = { @@ -32,5 +33,5 @@ export default function removeVoiceUser(meetingId, voiceUser) { return Logger.verbose(`Add voice user=${voiceUser.intId} meeting=${meetingId}`); }; - return VoiceUser.update(selector, modifier, cb); + return VoiceUsers.update(selector, modifier, cb); } diff --git a/bigbluebutton-html5/imports/api/2.0/voice-users/server/publishers.js b/bigbluebutton-html5/imports/api/2.0/voice-users/server/publishers.js index 89d4f7bbea..bc77c10087 100644 --- a/bigbluebutton-html5/imports/api/2.0/voice-users/server/publishers.js +++ b/bigbluebutton-html5/imports/api/2.0/voice-users/server/publishers.js @@ -1,4 +1,4 @@ -import VoiceUser from '/imports/api/2.0/voice-users'; +import VoiceUsers from '/imports/api/2.0/voice-users'; import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; import Logger from '/imports/startup/server/logger'; @@ -12,7 +12,7 @@ function voiceUser(credentials) { Logger.info(`Publishing Voice User for ${meetingId} ${requesterUserId}`); - return VoiceUser.find({ meetingId }); + return VoiceUsers.find({ meetingId }); } function publish(...args) { diff --git a/bigbluebutton-html5/imports/startup/client/base.jsx b/bigbluebutton-html5/imports/startup/client/base.jsx index 27aa07ac48..05a79dab0a 100755 --- a/bigbluebutton-html5/imports/startup/client/base.jsx +++ b/bigbluebutton-html5/imports/startup/client/base.jsx @@ -6,8 +6,8 @@ import AppContainer from '/imports/ui/components/app/container'; import ErrorScreen from '/imports/ui/components/error-screen/component'; import LoadingScreen from '/imports/ui/components/loading-screen/component'; import Settings from '/imports/ui/services/settings'; -import IntlStartup from './intl'; import { initBBB } from '/imports/api/2.0/bbb'; +import IntlStartup from './intl'; const BROWSER_LANGUAGE = window.navigator.userLanguage || window.navigator.language; @@ -89,7 +89,7 @@ Base.defaultProps = defaultProps; const SUBSCRIPTIONS_NAME = [ 'users2x', 'users', 'chat', 'chat2x', 'cursor', 'cursor2x', 'screenshare', 'meetings', 'meetings2x', 'polls', 'polls2x', 'presentations', 'presentations2x', 'shapes', 'shapes2x', 'slides', 'slides2x', 'captions', - 'captions2x', 'breakouts', 'breakouts2x', 'voiceUser', + 'captions2x', 'breakouts', 'breakouts2x', 'voiceUsers', ]; const BaseContainer = createContainer(({ params }) => { diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/mute-button/container.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/mute-button/container.jsx index e5b84c4a0f..da5a391f71 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/mute-button/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/mute-button/container.jsx @@ -1,41 +1,33 @@ import React from 'react'; import { createContainer } from 'meteor/react-meteor-data'; import { makeCall } from '/imports/ui/services/api'; -import Button from '/imports/ui/components/button/component'; -import Users from '/imports/api/2.0/users'; +import VoiceUsers from '/imports/api/2.0/voice-users'; import Auth from '/imports/ui/services/auth/index'; import MuteAudio from './component'; -class MuteAudioContainer extends React.Component { - render() { - return ( - - ); - } -} +const MuteAudioContainer = props => (); -export default createContainer((params) => { +export default createContainer(() => { const userId = Auth.userID; - const user = Users.findOne({ userId }).user; - const isMuted = user.voiceUser.muted; - const isInAudio = user.voiceUser.joined; - const isTalking = user.voiceUser.talking; + const voiceUser = VoiceUsers.findOne({ intId: userId }); + + const { muted, joined, talking } = voiceUser; let callback = () => { }; - if (isInAudio && !isMuted) { + if (joined && !muted) { callback = () => makeCall('muteUser', userId); } - if (isInAudio && isMuted) { + if (joined && muted) { callback = () => makeCall('unmuteUser', userId); } const data = { - isInAudio, - isMuted, + joined, + muted, callback, - isTalking, + talking, }; return data; }, MuteAudioContainer); diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-menu/container.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-menu/container.jsx index a5e6f168c6..e5062ff3a7 100755 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-menu/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-menu/container.jsx @@ -1,24 +1,20 @@ import React from 'react'; import { createContainer } from 'meteor/react-meteor-data'; -import Users from '/imports/api/2.0/users'; +import VoiceUsers from '/imports/api/2.0/voice-users'; import Auth from '/imports/ui/services/auth/index'; import JoinAudioOptions from './component'; -class JoinAudioOptionsContainer extends React.Component { - - render() { - return ( - - ); - } -} +const JoinAudioOptionsContainer = props => (); export default createContainer((params) => { - const user = Users.findOne({ userId: Auth.userID }).user; + const userId = Auth.userID; + const voiceUser = VoiceUsers.findOne({ intId: userId }); + + const { joined, listenOnly } = voiceUser; return { - isInAudio: user.voiceUser.joined, - isInListenOnly: user.listenOnly, + joined, + listenOnly, handleJoinAudio: params.handleJoinAudio, handleCloseAudio: params.handleCloseAudio, }; diff --git a/bigbluebutton-html5/imports/ui/components/chat/service.js b/bigbluebutton-html5/imports/ui/components/chat/service.js index f35911b9c6..796190e132 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/service.js +++ b/bigbluebutton-html5/imports/ui/components/chat/service.js @@ -4,6 +4,7 @@ import Users from '/imports/api/2.0/users'; import Auth from '/imports/ui/services/auth'; import UnreadMessages from '/imports/ui/services/unread-messages'; import Storage from '/imports/ui/services/storage/session'; +import mapUser from '/imports/ui/services/user/mapUser'; import { makeCall } from '/imports/ui/services/api'; import _ from 'lodash'; @@ -22,26 +23,6 @@ const ScrollCollection = new Mongo.Collection(null); // session for closed chat list const CLOSED_CHAT_LIST_KEY = 'closedChatList'; -/* TODO: Same map is done in the user-list/service we should share this someway */ - -const mapUser = user => ({ - id: user.userid, - name: user.name, - emoji: { - status: user.emoji, - changedAt: user.set_emoji_time, - }, - isPresenter: user.presenter, - isModerator: user.role === 'MODERATOR', - isCurrent: user.userid === Auth.userID, - isVoiceUser: user.voiceUser.joined, - isOnline: user.connection_status === 'online', - isMuted: user.voiceUser.muted, - isListenOnly: user.listenOnly, - isSharingWebcam: user.webcam_stream.length, - isLocked: user.locked, -}); - const getUser = (userID) => { const user = Users.findOne({ userId: userID }); @@ -137,7 +118,7 @@ const isChatLocked = (receiverID) => { /* meeting.roomLockSettings || { disablePublicChat: false, disablePrivateChat: false, - };*/ + }; */ if (!currentUser.isLocked || currentUser.isPresenter) { return false; diff --git a/bigbluebutton-html5/imports/ui/components/user-list/service.js b/bigbluebutton-html5/imports/ui/components/user-list/service.js index 516d688a99..18f0df655b 100644 --- a/bigbluebutton-html5/imports/ui/components/user-list/service.js +++ b/bigbluebutton-html5/imports/ui/components/user-list/service.js @@ -3,40 +3,17 @@ import Chat from '/imports/api/2.0/chat'; import Auth from '/imports/ui/services/auth'; import UnreadMessages from '/imports/ui/services/unread-messages'; import Storage from '/imports/ui/services/storage/session'; +import mapUser from '/imports/ui/services/user/mapUser'; import { EMOJI_STATUSES } from '/imports/utils/statuses'; import _ from 'lodash'; const CHAT_CONFIG = Meteor.settings.public.chat; -const USER_CONFIG = Meteor.settings.public.user; -const ROLE_MODERATOR = USER_CONFIG.role_moderator; const PRIVATE_CHAT_TYPE = CHAT_CONFIG.type_private; const PUBLIC_CHAT_USERID = CHAT_CONFIG.public_userid; // session for closed chat list const CLOSED_CHAT_LIST_KEY = 'closedChatList'; -/* TODO: Same map is done in the chat/service we should share this someway */ - -const mapUser = user => ({ - id: user.userid, - name: user.name, - emoji: { - status: user.emoji, - changedAt: user.set_emoji_time, - }, - isPresenter: user.presenter, - isModerator: user.role === ROLE_MODERATOR, - isCurrent: user.userid === Auth.userID, - isVoiceUser: user.voiceUser.joined, - isMuted: user.voiceUser.muted, - isTalking: user.voiceUser.talking, - isListenOnly: user.listenOnly, - isSharingWebcam: user.webcam_stream.length, - isPhoneUser: user.phone_user, - isOnline: user.connection_status === 'online', - isLocked: user.locked, -}); - const mapOpenChats = (chat) => { const currentUserId = Auth.userID; return chat.message.fromUserId !== currentUserId diff --git a/bigbluebutton-html5/imports/ui/services/user/mapUser.js b/bigbluebutton-html5/imports/ui/services/user/mapUser.js new file mode 100644 index 0000000000..697e2f330e --- /dev/null +++ b/bigbluebutton-html5/imports/ui/services/user/mapUser.js @@ -0,0 +1,35 @@ +import Auth from '/imports/ui/services/auth'; +import VoiceUsers from '/imports/api/2.0/voice-users'; + +const USER_CONFIG = Meteor.settings.public.user; +const ROLE_MODERATOR = USER_CONFIG.role_moderator; + +const mapUser = (user) => { + const userId = Auth.userID; + const voiceUser = VoiceUsers.findOne({ intId: userId }); + const { muted, joined, talking, listenOnly } = voiceUser; + + const mapedUser = { + id: user.userid, + name: user.name, + emoji: { + status: user.emoji, + changedAt: user.set_emoji_time, + }, + isPresenter: user.presenter, + isModerator: user.role === ROLE_MODERATOR, + isCurrent: user.userid === userId, + isVoiceUser: joined, + isMuted: muted, + isTalking: talking, + isListenOnly: listenOnly, + isSharingWebcam: 0, + isPhoneUser: user.phone_user, + isOnline: user.connection_status === 'online', + isLocked: user.locked, + }; + + return mapedUser; +}; + +export default mapUser; diff --git a/bigbluebutton-html5/private/config/public/acl.yaml b/bigbluebutton-html5/private/config/public/acl.yaml index 8d720bbabb..452ed88756 100644 --- a/bigbluebutton-html5/private/config/public/acl.yaml +++ b/bigbluebutton-html5/private/config/public/acl.yaml @@ -12,7 +12,7 @@ acl: - 'slides' - 'captions' - 'breakouts' - - 'voiceUser' + - 'voiceUsers' methods: - 'listenOnlyToggle' - 'userLogout' diff --git a/bigbluebutton-html5/server/main.js b/bigbluebutton-html5/server/main.js index fef41afc49..67ed495efa 100755 --- a/bigbluebutton-html5/server/main.js +++ b/bigbluebutton-html5/server/main.js @@ -23,7 +23,7 @@ import '/imports/api/2.0/slides/server'; import '/imports/api/2.0/breakouts/server'; import '/imports/api/2.0/chat/server'; import '/imports/api/2.0/screenshare/server'; -import '/imports/api/2.0/voice-user/server'; +import '/imports/api/2.0/voice-users/server'; // Commons import '/imports/api/log-client/server';