Merge pull request #5865 from Tainan404/issue-5675
Add user when moderator join via audio only in breakout room
This commit is contained in:
commit
488f6c04e1
67
bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js
Normal file → Executable file
67
bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js
Normal file → Executable file
@ -1,7 +1,6 @@
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import addUser from '/imports/api/users/server/modifiers/addUser';
|
||||
import addVoiceUser from '../modifiers/addVoiceUser';
|
||||
|
||||
export default function handleJoinVoiceUser({ body }, meetingId) {
|
||||
@ -27,56 +26,34 @@ export default function handleJoinVoiceUser({ body }, meetingId) {
|
||||
callerName,
|
||||
} = voiceUser;
|
||||
|
||||
if (intId.toString().startsWith('v_')) {
|
||||
/* voice-only user - called into the conference */
|
||||
const User = Users.findOne({
|
||||
meetingId,
|
||||
intId,
|
||||
connectionStatus: 'online',
|
||||
});
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
userId: intId,
|
||||
};
|
||||
if (!User) {
|
||||
/* voice-only user - called into the conference */
|
||||
|
||||
const USER_CONFIG = Meteor.settings.public.user;
|
||||
const ROLE_VIEWER = USER_CONFIG.role_viewer;
|
||||
|
||||
const modifier = { // web (Users) representation of dial-in user
|
||||
$set: {
|
||||
meetingId,
|
||||
connectionStatus: 'online',
|
||||
roles: [ROLE_VIEWER.toLowerCase()],
|
||||
sortName: callerName.trim().toLowerCase(),
|
||||
color: '#ffffff', // TODO
|
||||
intId,
|
||||
extId: intId, // TODO
|
||||
name: callerName,
|
||||
role: ROLE_VIEWER.toLowerCase(),
|
||||
guest: false,
|
||||
authed: true,
|
||||
waitingForAcceptance: false,
|
||||
emoji: 'none',
|
||||
presenter: false,
|
||||
locked: false, // TODO
|
||||
avatar: '',
|
||||
clientType: 'dial-in-user',
|
||||
},
|
||||
const voiceOnlyUser = { // web (Users) representation of dial-in user
|
||||
intId,
|
||||
extId: intId, // TODO
|
||||
name: callerName,
|
||||
role: ROLE_VIEWER.toLowerCase(),
|
||||
guest: false,
|
||||
authed: true,
|
||||
waitingForAcceptance: false,
|
||||
emoji: 'none',
|
||||
presenter: false,
|
||||
locked: false, // TODO
|
||||
avatar: 'https://bbb-joao.dev.imdt.com.br/client/avatar.png',
|
||||
clientType: 'dial-in-user',
|
||||
};
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding call-in user to VoiceUser collection: ${err}`);
|
||||
}
|
||||
|
||||
const { insertedId } = numChanged;
|
||||
if (insertedId) {
|
||||
return Logger.info(`Added a call-in user id=${intId} meeting=${meetingId}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted a call-in user id=${intId} meeting=${meetingId}`);
|
||||
};
|
||||
|
||||
Users.upsert(selector, modifier, cb);
|
||||
} else {
|
||||
|
||||
/* there is a corresponding web user in Users collection -- no need to add new one */
|
||||
addUser(meetingId, voiceOnlyUser);
|
||||
}
|
||||
|
||||
return addVoiceUser(meetingId, voiceUser);
|
||||
|
10
bigbluebutton-html5/imports/api/voice-users/server/handlers/leftVoiceUser.js
Normal file → Executable file
10
bigbluebutton-html5/imports/api/voice-users/server/handlers/leftVoiceUser.js
Normal file → Executable file
@ -2,6 +2,7 @@ import { check } from 'meteor/check';
|
||||
|
||||
import removeVoiceUser from '/imports/api/voice-users/server/modifiers/removeVoiceUser';
|
||||
import removeUser from '/imports/api/users/server/modifiers/removeUser';
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
export default function handleVoiceUpdate({ body }, meetingId) {
|
||||
const voiceUser = body;
|
||||
@ -13,12 +14,15 @@ export default function handleVoiceUpdate({ body }, meetingId) {
|
||||
voiceUserId: String,
|
||||
});
|
||||
|
||||
const { intId, voiceUserId } = voiceUser;
|
||||
const {
|
||||
intId,
|
||||
voiceUserId,
|
||||
} = voiceUser;
|
||||
|
||||
const isDialInUser = userId => userId && (userId[0] === 'v');
|
||||
const isDialInUser = (userId, meetingID) => !!Users.findOne({ meetingId: meetingID, userId, clientType: 'dial-in-user' });
|
||||
|
||||
// if the user is dial-in, leaving voice also means leaving userlist
|
||||
if (isDialInUser(voiceUserId)) removeUser(meetingId, intId);
|
||||
if (isDialInUser(voiceUserId, meetingId)) removeUser(meetingId, intId);
|
||||
|
||||
return removeVoiceUser(meetingId, voiceUser);
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ class UserListContent extends Component {
|
||||
this.onActionsShow = this.onActionsShow.bind(this);
|
||||
this.onActionsHide = this.onActionsHide.bind(this);
|
||||
this.getDropdownMenuParent = this.getDropdownMenuParent.bind(this);
|
||||
this.renderUserAvatar = this.renderUserAvatar.bind(this);
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
@ -175,12 +176,41 @@ class UserListContent extends Component {
|
||||
return isActionsOpen && !dropdownVisible;
|
||||
}
|
||||
|
||||
renderUserAvatar() {
|
||||
const {
|
||||
normalizeEmojiName,
|
||||
user,
|
||||
} = this.props;
|
||||
|
||||
const { clientType } = user;
|
||||
const isVoiceOnly = clientType === 'dial-in-user';
|
||||
|
||||
const iconUser = user.emoji.status !== 'none' ?
|
||||
(<Icon iconName={normalizeEmojiName(user.emoji.status)} />) :
|
||||
user.name.toLowerCase().slice(0, 2);
|
||||
|
||||
const iconVoiceOnlyUser = (<Icon iconName="speak_louder" />);
|
||||
|
||||
return (
|
||||
<UserAvatar
|
||||
moderator={user.isModerator}
|
||||
presenter={user.isPresenter}
|
||||
talking={user.isTalking}
|
||||
muted={user.isMuted}
|
||||
listenOnly={user.isListenOnly}
|
||||
voice={user.isVoiceUser}
|
||||
color={user.color}
|
||||
>
|
||||
{isVoiceOnly ? iconVoiceOnlyUser : iconUser }
|
||||
</UserAvatar>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
compact,
|
||||
user,
|
||||
intl,
|
||||
normalizeEmojiName,
|
||||
actions,
|
||||
isMeetingLocked,
|
||||
meeting,
|
||||
@ -222,19 +252,7 @@ class UserListContent extends Component {
|
||||
>
|
||||
<div className={styles.userItemContents}>
|
||||
<div className={styles.userAvatar}>
|
||||
<UserAvatar
|
||||
moderator={user.isModerator}
|
||||
presenter={user.isPresenter}
|
||||
talking={user.isTalking}
|
||||
muted={user.isMuted}
|
||||
listenOnly={user.isListenOnly}
|
||||
voice={user.isVoiceUser}
|
||||
color={user.color}
|
||||
>
|
||||
{user.emoji.status !== 'none' ?
|
||||
<Icon iconName={normalizeEmojiName(user.emoji.status)} /> :
|
||||
user.name.toLowerCase().slice(0, 2)}
|
||||
</UserAvatar>
|
||||
{ this.renderUserAvatar() }
|
||||
</div>
|
||||
{<UserName
|
||||
user={user}
|
||||
|
@ -29,6 +29,7 @@ const mapUser = (user) => {
|
||||
isSharingWebcam: user.has_stream,
|
||||
isPhoneUser: user.phone_user,
|
||||
isOnline: user.connectionStatus === 'online',
|
||||
clientType: user.clientType,
|
||||
};
|
||||
|
||||
mappedUser.isLocked = user.locked && !(mappedUser.isPresenter || mappedUser.isModerator);
|
||||
|
Loading…
Reference in New Issue
Block a user