From 37dea2215b3a7d7ffc9c3c879e2b456ffdf72533 Mon Sep 17 00:00:00 2001 From: Gustavo Trott Date: Mon, 14 Jun 2021 16:59:27 -0300 Subject: [PATCH] Translates dynamically breakout room Names when default name is being used --- .../core/apps/BreakoutModel.scala | 4 +- .../breakout/BreakoutRoomCreatedMsgHdlr.scala | 4 +- .../breakout/BreakoutRoomsListMsgHdlr.scala | 2 +- .../CreateBreakoutRoomsCmdMsgHdlr.scala | 4 +- .../core/domain/BreakoutRoom2x.scala | 2 + .../common2/msgs/BreakoutMsgs.scala | 6 ++- .../messages/CreateBreakoutRoom.java | 6 +++ .../api2/meeting/OldMeetingMsgHdlrActor.scala | 2 + .../create-breakout-room/component.jsx | 37 ++++++++++++++----- .../ui/components/actions-bar/service.js | 2 +- .../ui/components/breakout-room/component.jsx | 4 +- 11 files changed, 54 insertions(+), 19 deletions(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/BreakoutModel.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/BreakoutModel.scala index 099475f584..c4911d14b0 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/BreakoutModel.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/BreakoutModel.scala @@ -9,11 +9,13 @@ object BreakoutModel { externalId: String, name: String, sequence: Integer, + shortName: String, + isDefaultName: Boolean, freeJoin: Boolean, voiceConf: String, assignedUsers: Vector[String] ): BreakoutRoom2x = { - new BreakoutRoom2x(id, externalId, name, parentId, sequence, freeJoin, voiceConf, assignedUsers, Vector(), Vector(), None, false) + new BreakoutRoom2x(id, externalId, name, parentId, sequence, shortName, isDefaultName, freeJoin, voiceConf, assignedUsers, Vector(), Vector(), None, false) } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomCreatedMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomCreatedMsgHdlr.scala index bce40f1cf0..49df85b23a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomCreatedMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomCreatedMsgHdlr.scala @@ -68,7 +68,7 @@ trait BreakoutRoomCreatedMsgHdlr { def sendBreakoutRoomsList(breakoutModel: BreakoutModel): BreakoutModel = { val breakoutRooms = breakoutModel.rooms.values.toVector map { r => - new BreakoutRoomInfo(r.name, r.externalId, r.id, r.sequence, r.freeJoin) + new BreakoutRoomInfo(r.name, r.externalId, r.id, r.sequence, r.shortName, r.isDefaultName, r.freeJoin) } log.info("Sending breakout rooms list to {} with containing {} room(s)", liveMeeting.props.meetingProp.intId, breakoutRooms.length) @@ -95,7 +95,7 @@ trait BreakoutRoomCreatedMsgHdlr { BbbCommonEnvCoreMsg(envelope, event) } - val breakoutInfo = BreakoutRoomInfo(room.name, room.externalId, room.id, room.sequence, room.freeJoin) + val breakoutInfo = BreakoutRoomInfo(room.name, room.externalId, room.id, room.sequence, room.shortName, room.isDefaultName, room.freeJoin) val event = build(liveMeeting.props.meetingProp.intId, breakoutInfo) outGW.send(event) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomsListMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomsListMsgHdlr.scala index 860c3bcdc7..dfcd84f65a 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomsListMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/BreakoutRoomsListMsgHdlr.scala @@ -28,7 +28,7 @@ trait BreakoutRoomsListMsgHdlr { breakoutModel <- state.breakout } yield { val rooms = breakoutModel.rooms.values.toVector map { r => - new BreakoutRoomInfo(r.name, r.externalId, r.id, r.sequence, r.freeJoin) + new BreakoutRoomInfo(r.name, r.externalId, r.id, r.sequence, r.shortName, r.isDefaultName, r.freeJoin) } val ready = breakoutModel.hasAllStarted() broadcastEvent(rooms, ready) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala index 950f77b0ba..9a04a0c54c 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/breakout/CreateBreakoutRoomsCmdMsgHdlr.scala @@ -47,7 +47,7 @@ trait CreateBreakoutRoomsCmdMsgHdlr extends RightsManagementTrait { val (internalId, externalId) = BreakoutRoomsUtil.createMeetingIds(liveMeeting.props.meetingProp.intId, i) val voiceConf = BreakoutRoomsUtil.createVoiceConfId(liveMeeting.props.voiceProp.voiceConf, i) - val breakout = BreakoutModel.create(parentId, internalId, externalId, room.name, room.sequence, room.freeJoin, voiceConf, room.users) + val breakout = BreakoutModel.create(parentId, internalId, externalId, room.name, room.sequence, room.shortName, room.isDefaultName, room.freeJoin, voiceConf, room.users) rooms = rooms + (breakout.id -> breakout) } @@ -56,6 +56,8 @@ trait CreateBreakoutRoomsCmdMsgHdlr extends RightsManagementTrait { breakout.id, breakout.name, liveMeeting.props.meetingProp.intId, breakout.sequence, + breakout.shortName, + breakout.isDefaultName, breakout.freeJoin, liveMeeting.props.voiceProp.dialNumber, breakout.voiceConf, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/BreakoutRoom2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/BreakoutRoom2x.scala index 00c1eea66d..1c124bf980 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/BreakoutRoom2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/BreakoutRoom2x.scala @@ -6,6 +6,8 @@ case class BreakoutRoom2x( name: String, parentId: String, sequence: Int, + shortName: String, + isDefaultName: Boolean, freeJoin: Boolean, voiceConf: String, assignedUsers: Vector[String], diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala index e94a7565cd..9452d51822 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/BreakoutMsgs.scala @@ -13,7 +13,7 @@ case class BreakoutRoomJoinURLEvtMsgBody(parentId: String, breakoutId: String, e object BreakoutRoomsListEvtMsg { val NAME = "BreakoutRoomsListEvtMsg" } case class BreakoutRoomsListEvtMsg(header: BbbClientMsgHeader, body: BreakoutRoomsListEvtMsgBody) extends BbbCoreMsg case class BreakoutRoomsListEvtMsgBody(meetingId: String, rooms: Vector[BreakoutRoomInfo], roomsReady: Boolean) -case class BreakoutRoomInfo(name: String, externalId: String, breakoutId: String, sequence: Int, freeJoin: Boolean) +case class BreakoutRoomInfo(name: String, externalId: String, breakoutId: String, sequence: Int, shortName: String, isDefaultName: Boolean, freeJoin: Boolean) object BreakoutRoomsListMsg { val NAME = "BreakoutRoomsListMsg" } case class BreakoutRoomsListMsg(header: BbbClientMsgHeader, body: BreakoutRoomsListMsgBody) extends StandardMsg @@ -47,6 +47,8 @@ case class BreakoutRoomDetail( name: String, parentId: String, sequence: Integer, + shortName: String, + isDefaultName: Boolean, freeJoin: Boolean, dialNumber: String, voiceConfId: String, @@ -65,7 +67,7 @@ case class BreakoutRoomDetail( object CreateBreakoutRoomsCmdMsg { val NAME = "CreateBreakoutRoomsCmdMsg" } case class CreateBreakoutRoomsCmdMsg(header: BbbClientMsgHeader, body: CreateBreakoutRoomsCmdMsgBody) extends StandardMsg case class CreateBreakoutRoomsCmdMsgBody(meetingId: String, durationInMinutes: Int, record: Boolean, rooms: Vector[BreakoutRoomMsgBody]) -case class BreakoutRoomMsgBody(name: String, sequence: Int, freeJoin: Boolean, users: Vector[String]) +case class BreakoutRoomMsgBody(name: String, sequence: Int, shortName: String, isDefaultName: Boolean, freeJoin: Boolean, users: Vector[String]) // Sent by user to request ending all the breakout rooms object EndAllBreakoutRoomsMsg { val NAME = "EndAllBreakoutRoomsMsg" } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java index 2ac72332e2..fc5a8ee5d2 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/messaging/messages/CreateBreakoutRoom.java @@ -6,6 +6,8 @@ public class CreateBreakoutRoom implements IMessage { public final String parentMeetingId; // The main meeting internal id public final String name; // The name of the breakout room public final Integer sequence; // The sequence number of the breakout room + public final String shortName; // Name used in breakout rooms list + public final Boolean isDefaultName; // Inform if using default name or changed by moderator public final Boolean freeJoin; // Allow users to freely join the conference // in the client public final String dialNumber; @@ -22,6 +24,8 @@ public class CreateBreakoutRoom implements IMessage { String parentMeetingId, String name, Integer sequence, + String shortName, + Boolean isDefaultName, Boolean freeJoin, String dialNumber, String voiceConfId, @@ -36,6 +40,8 @@ public class CreateBreakoutRoom implements IMessage { this.parentMeetingId = parentMeetingId; this.name = name; this.sequence = sequence; + this.shortName = shortName; + this.isDefaultName = isDefaultName; this.freeJoin = freeJoin; this.dialNumber = dialNumber; this.voiceConfId = voiceConfId; diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala index d42b2e82a7..f2dd7bd822 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/OldMeetingMsgHdlrActor.scala @@ -87,6 +87,8 @@ class OldMeetingMsgHdlrActor(val olgMsgGW: OldMessageReceivedGW) msg.body.room.parentId, msg.body.room.name, msg.body.room.sequence, + msg.body.room.shortName, + msg.body.room.isDefaultName, msg.body.room.freeJoin, msg.body.room.dialNumber, msg.body.room.voiceConfId, diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/create-breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/create-breakout-room/component.jsx index 04c526eb19..7f61ff14fe 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/create-breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/create-breakout-room/component.jsx @@ -43,9 +43,9 @@ const intlMessages = defineMessages({ id: 'app.createBreakoutRoom.randomlyAssign', description: 'randomly assign label', }, - roomName: { - id: 'app.createBreakoutRoom.roomName', - description: 'room intl to name the breakout meetings', + breakoutRoom: { + id: 'app.createBreakoutRoom.room', + description: 'breakout room', }, freeJoinLabel: { id: 'app.createBreakoutRoom.freeJoin', @@ -345,7 +345,9 @@ class BreakoutRoom extends PureComponent { const rooms = _.range(1, numberOfRooms + 1).map((seq) => ({ users: this.getUserByRoom(seq).map((u) => u.userId), - name: this.getRoomName(seq), + name: this.getFullName(seq), + shortName: this.getRoomName(seq), + isDefaultName: !this.hasNameChanged(seq), freeJoin, sequence: seq, })); @@ -514,17 +516,32 @@ class BreakoutRoom extends PureComponent { } getRoomName(position) { - const { intl, meetingName } = this.props; + const { intl } = this.props; const { roomNamesChanged } = this.state; - if (typeof roomNamesChanged[position] !== 'undefined') { + if (this.hasNameChanged(position)) { return roomNamesChanged[position]; } - return intl.formatMessage(intlMessages.roomName, { - 0: meetingName, - 1: position, - }); + return intl.formatMessage(intlMessages.breakoutRoom, { 0: position }); + } + + getFullName(position) { + const { meetingName } = this.props; + + return `${meetingName} (${this.getRoomName(position)})`; + } + + hasNameChanged(position) { + const { intl } = this.props; + const { roomNamesChanged } = this.state; + + if (typeof roomNamesChanged[position] !== 'undefined' + && roomNamesChanged[position] !== intl.formatMessage(intlMessages.breakoutRoom, { 0: position })) { + return true; + } else { + return false; + } } hasNameDuplicated(position) { diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/service.js b/bigbluebutton-html5/imports/ui/components/actions-bar/service.js index 67ec51e749..80ddea0d7f 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/service.js +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/service.js @@ -65,7 +65,7 @@ export default { isBreakoutRecordable: () => Meetings.findOne({ meetingId: Auth.meetingID }, { fields: { 'breakoutProps.record': 1 } }).breakoutProps.record, toggleRecording: () => makeCall('toggleRecording'), - createBreakoutRoom: (numberOfRooms, durationInMinutes, record = false) => makeCall('createBreakoutRoom', numberOfRooms, durationInMinutes, record), + createBreakoutRoom: (rooms, durationInMinutes, record = false) => makeCall('createBreakoutRoom', rooms, durationInMinutes, record), sendInvitation: (breakoutId, userId) => makeCall('requestJoinURL', { breakoutId, userId }), breakoutJoinedUsers: () => Breakouts.find({ joinedUsers: { $exists: true }, diff --git a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx index 4673536f8e..eb7d682e32 100644 --- a/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/breakout-room/component.jsx @@ -335,7 +335,9 @@ class BreakoutRoom extends PureComponent { >
- {breakout.name} + { breakout.isDefaultName + ? intl.formatMessage(intlMessages.breakoutRoom, { 0: breakout.sequence }) + : breakout.shortName } ( {breakout.joinedUsers.length}