Adds prop color for voiceUsers create msgs

This commit is contained in:
Gustavo Trott 2023-04-19 12:16:35 -03:00
parent c89349858b
commit d19d286811
17 changed files with 32 additions and 27 deletions

View File

@ -19,8 +19,8 @@ trait UserConnectedToGlobalAudioMsgHdlr {
val header = BbbClientMsgHeader(UserJoinedVoiceConfToClientEvtMsg.NAME, props.meetingProp.intId, vu.intId)
val body = UserJoinedVoiceConfToClientEvtMsgBody(voiceConf = msg.header.voiceConf, intId = vu.intId, voiceUserId = vu.intId,
callingWith = vu.callingWith, callerName = vu.callerName,
callerNum = vu.callerNum, muted = true, talking = false, listenOnly = true)
callingWith = vu.callingWith, callerName = vu.callerName, callerNum = vu.callerNum, color = vu.color,
muted = true, talking = false, listenOnly = true)
val event = UserJoinedVoiceConfToClientEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
@ -36,6 +36,7 @@ trait UserConnectedToGlobalAudioMsgHdlr {
callingWith = "flash",
callerName = user.name,
callerNum = user.name,
color = user.color,
muted = true,
talking = false,
listenOnly = true,

View File

@ -130,7 +130,7 @@ trait ValidateAuthTokenReqMsgHdlr extends HandlerHelpers {
def sendAllVoiceUsersInMeeting(requesterId: String, voiceUsers: VoiceUsers, meetingId: String): Unit = {
val vu = VoiceUsers.findAll(voiceUsers).map { u =>
VoiceConfUser(intId = u.intId, voiceUserId = u.voiceUserId, callingWith = u.callingWith, callerName = u.callerName,
callerNum = u.callerNum, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly)
callerNum = u.callerNum, color = u.color, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly)
}
val event = MsgBuilder.buildGetVoiceUsersMeetingRespMsg(meetingId, requesterId, vu)

View File

@ -14,7 +14,7 @@ trait SyncGetVoiceUsersMsgHdlr {
def buildSyncGetVoiceUsersRespMsg(): BbbCommonEnvCoreMsg = {
val voiceUsers = VoiceUsers.findAll(liveMeeting.voiceUsers).map { u =>
VoiceConfUser(intId = u.intId, voiceUserId = u.voiceUserId, callingWith = u.callingWith, callerName = u.callerName,
callerNum = u.callerNum, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly)
callerNum = u.callerNum, color = u.color, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly)
}
val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString)

View File

@ -88,6 +88,7 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration {
msg.body.callingWith,
msg.body.callerIdName,
msg.body.callerIdNum,
userColor,
msg.body.muted,
msg.body.talking,
"freeswitch"

View File

@ -7,9 +7,10 @@ import org.bigbluebutton.core.bus.InternalEventBus
import org.bigbluebutton.core2.MeetingStatus2x
import org.bigbluebutton.core2.message.senders.MsgBuilder
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
import org.bigbluebutton.core.running.{LiveMeeting, MeetingActor, OutMsgRouter}
import org.bigbluebutton.core.models._
import org.bigbluebutton.core.apps.users.UsersApp
import org.bigbluebutton.core.util.ColorPicker
object VoiceApp extends SystemConfiguration {
@ -164,6 +165,7 @@ object VoiceApp extends SystemConfiguration {
cvu.callingWith,
cvu.callerIdName,
cvu.callerIdNum,
ColorPicker.nextColor(liveMeeting.props.meetingProp.intId),
cvu.muted,
cvu.talking,
cvu.calledInto
@ -213,6 +215,7 @@ object VoiceApp extends SystemConfiguration {
callingWith: String,
callerIdName: String,
callerIdNum: String,
color: String,
muted: Boolean,
talking: Boolean,
callingInto: String
@ -240,6 +243,7 @@ object VoiceApp extends SystemConfiguration {
voiceUserState.voiceUserId,
voiceUserState.callerName,
voiceUserState.callerNum,
voiceUserState.color,
voiceUserState.muted,
voiceUserState.talking,
voiceUserState.callingWith,
@ -267,6 +271,7 @@ object VoiceApp extends SystemConfiguration {
callingWith,
callerIdName,
callerIdNum,
color,
muted,
talking,
listenOnly = isListenOnly,

View File

@ -174,6 +174,7 @@ case class VoiceUserState(
callingWith: String,
callerName: String,
callerNum: String,
color: String,
muted: Boolean,
talking: Boolean,
listenOnly: Boolean,

View File

@ -42,6 +42,7 @@ trait GuestsWaitingApprovedMsgHdlr extends HandlerHelpers with RightsManagementT
"none",
dialInUser.name,
dialInUser.name,
dialInUser.color,
MeetingStatus2x.isMeetingMuted(liveMeeting.status),
false,
"freeswitch"

View File

@ -65,7 +65,7 @@ object FakeUserGenerator {
val voiceUserId = RandomStringGenerator.randomAlphanumericString(8)
val lastFloorTime = System.currentTimeMillis().toString();
VoiceUserState(intId = user.id, voiceUserId = voiceUserId, callingWith, callerName = user.name,
callerNum = user.name, muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime)
callerNum = user.name, "#ff6242", muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime)
}
def createFakeVoiceOnlyUser(callingWith: String, muted: Boolean, talking: Boolean,
@ -75,7 +75,7 @@ object FakeUserGenerator {
val name = getRandomElement(firstNames, random) + " " + getRandomElement(lastNames, random)
val lastFloorTime = System.currentTimeMillis().toString();
VoiceUserState(intId, voiceUserId = voiceUserId, callingWith, callerName = name,
callerNum = name, muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime)
callerNum = name, "#ff6242", muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime)
}
def createFakeWebcamStreamFor(userId: String, subscribers: Set[String]): WebcamStream = {

View File

@ -24,7 +24,7 @@ object TestDataGen {
listenOnly: Boolean): VoiceUserState = {
val voiceUserId = RandomStringGenerator.randomAlphanumericString(8)
VoiceUserState(intId = user.id, voiceUserId = voiceUserId, callingWith, callerName = user.name,
callerNum = user.name, muted, talking, listenOnly)
callerNum = user.name, "#ff6242", muted, talking, listenOnly)
}
def createFakeVoiceOnlyUser(callingWith: String, muted: Boolean, talking: Boolean,
@ -32,7 +32,7 @@ object TestDataGen {
val voiceUserId = RandomStringGenerator.randomAlphanumericString(8)
val intId = "v_" + RandomStringGenerator.randomAlphanumericString(16)
VoiceUserState(intId, voiceUserId = voiceUserId, callingWith, callerName = name,
callerNum = name, muted, talking, listenOnly)
callerNum = name, "#ff6242", muted, talking, listenOnly)
}
def createFakeWebcamStreamFor(userId: String, subscribers: Set[String]): WebcamStream = {

View File

@ -373,7 +373,7 @@ object GetVoiceUsersMeetingRespMsg {
case class GetVoiceUsersMeetingRespMsg(header: BbbClientMsgHeader, body: GetVoiceUsersMeetingRespMsgBody) extends BbbCoreMsg
case class GetVoiceUsersMeetingRespMsgBody(users: Vector[VoiceConfUser])
case class VoiceConfUser(intId: String, voiceUserId: String, callingWith: String, callerName: String,
callerNum: String, muted: Boolean, talking: Boolean, listenOnly: Boolean)
callerNum: String, color: String, muted: Boolean, talking: Boolean, listenOnly: Boolean)
/**
* Sent from client to add user to the presenter group of a meeting.

View File

@ -408,7 +408,7 @@ case class UserJoinedVoiceConfEvtMsgBody(voiceConf: String, voiceUserId: String,
object UserJoinedVoiceConfToClientEvtMsg { val NAME = "UserJoinedVoiceConfToClientEvtMsg" }
case class UserJoinedVoiceConfToClientEvtMsg(header: BbbClientMsgHeader, body: UserJoinedVoiceConfToClientEvtMsgBody) extends BbbCoreMsg
case class UserJoinedVoiceConfToClientEvtMsgBody(voiceConf: String, intId: String, voiceUserId: String, callerName: String,
callerNum: String, muted: Boolean,
callerNum: String, color: String, muted: Boolean,
talking: Boolean, callingWith: String, listenOnly: Boolean)
/**

View File

@ -8,7 +8,7 @@ export default async function addDialInUser(meetingId, voiceUser) {
const USER_CONFIG = Meteor.settings.public.user;
const ROLE_VIEWER = USER_CONFIG.role_viewer;
const { intId, callerName } = voiceUser;
const { intId, callerName, color } = voiceUser;
const voiceOnlyUser = {
intId,
@ -23,6 +23,7 @@ export default async function addDialInUser(meetingId, voiceUser) {
presenter: false,
locked: false, // TODO
avatar: '',
color,
pin: false,
clientType: 'dial-in-user',
};

View File

@ -70,6 +70,7 @@ export default async function addUser(meetingId, userData) {
intId: userId,
callerName: user.name,
callerNum: '',
color: user.color,
muted: false,
talking: false,
callingWith: '',

View File

@ -40,6 +40,7 @@ export default async function handleGetVoiceUsers({ body }, meetingId) {
callerName: user.callerName,
callerNum: user.callerNum,
muted: user.muted,
color: user.color,
talking: user.talking,
callingWith: user.callingWith,
listenOnly: user.listenOnly,

View File

@ -3,7 +3,6 @@ import Users from '/imports/api/users';
import addDialInUser from '/imports/api/users/server/modifiers/addDialInUser';
import addVoiceUser from '../modifiers/addVoiceUser';
export default async function handleJoinVoiceUser({ body }, meetingId) {
const voiceUser = body;
voiceUser.joined = true;
@ -15,6 +14,7 @@ export default async function handleJoinVoiceUser({ body }, meetingId) {
voiceUserId: String,
callerName: String,
callerNum: String,
color: String,
muted: Boolean,
talking: Boolean,
callingWith: String,

View File

@ -5,7 +5,6 @@ import removeVoiceUser from '../modifiers/removeVoiceUser';
import updateVoiceUser from '../modifiers/updateVoiceUser';
import addVoiceUser from '../modifiers/addVoiceUser';
export default async function handleVoiceUsers({ header, body }) {
const { voiceUsers } = body;
const { meetingId } = header;
@ -38,6 +37,7 @@ export default async function handleVoiceUsers({ header, body }) {
intId: voice.intId,
callerName: voice.callerName,
callerNum: voice.callerNum,
color: voice.color,
muted: voice.muted,
talking: voice.talking,
callingWith: voice.callingWith,

View File

@ -1,7 +1,6 @@
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import VoiceUsers from '/imports/api/voice-users';
import Users from '/imports/api/users';
import flat from 'flat';
export default async function addVoiceUser(meetingId, voiceUser) {
@ -11,6 +10,7 @@ export default async function addVoiceUser(meetingId, voiceUser) {
intId: String,
callerName: String,
callerNum: String,
color: String,
muted: Boolean,
talking: Boolean,
callingWith: String,
@ -27,19 +27,12 @@ export default async function addVoiceUser(meetingId, voiceUser) {
};
const modifier = {
$set: Object.assign(
{ meetingId, spoke: talking },
flat(voiceUser),
),
};
const user = await Users.findOneAsync({ meetingId, userId: intId }, {
fields: {
color: 1,
$set: {
meetingId,
spoke: talking,
...flat(voiceUser),
},
});
if (user) modifier.$set.color = user.color;
};
try {
const { numberAffected } = await VoiceUsers.upsertAsync(selector, modifier);