Skip to content

Commit

Permalink
feat(breakout-rooms): moderation of visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
wfleischer committed Dec 24, 2021
1 parent 55a03ac commit 2d7f0ab
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions modules/xmpp/BreakoutRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import XMPPEvents from '../../service/xmpp/XMPPEvents';
const FEATURE_KEY = 'features/breakout-rooms';
const BREAKOUT_ROOM_ACTIONS = {
ADD: `${FEATURE_KEY}/add`,
PUBLISH: `${FEATURE_KEY}/publish`,
REMOVE: `${FEATURE_KEY}/remove`,
MOVE_TO_ROOM: `${FEATURE_KEY}/move-to-room`
};
Expand Down Expand Up @@ -49,7 +50,7 @@ export default class BreakoutRooms {
*/
createBreakoutRoom(subject) {
if (!this.isSupported() || !this.room.isModerator()) {
logger.error(`Cannot create breakout room - supported:${this.isSupported()},
logger.error(`Cannot create breakout room - supported:${this.isSupported()},
moderator:${this.room.isModerator()}`);

return;
Expand All @@ -70,7 +71,7 @@ export default class BreakoutRooms {
*/
removeBreakoutRoom(breakoutRoomJid) {
if (!this.isSupported() || !this.room.isModerator()) {
logger.error(`Cannot remove breakout room - supported:${this.isSupported()},
logger.error(`Cannot remove breakout room - supported:${this.isSupported()},
moderator:${this.room.isModerator()}`);

return;
Expand All @@ -84,6 +85,27 @@ export default class BreakoutRooms {
this._sendMessage(message);
}

/**
* Set whether breakout rooms should be published to participants.
*
* @param {boolean} published - Whether the breakout rooms should be published.
*/
publish(published = true) {
if (!this.isSupported() || !this.room.isModerator()) {
logger.error(`Cannot publish breakout rooms - supported:${this.isSupported()},
moderator:${this.room.isModerator()}`);

return;
}

const message = {
type: BREAKOUT_ROOM_ACTIONS.PUBLISH,
published
};

this._sendMessage(message);
}

/**
* Sends the given participant to the given room.
*
Expand All @@ -92,7 +114,7 @@ export default class BreakoutRooms {
*/
sendParticipantToRoom(participantJid, roomJid) {
if (!this.isSupported() || !this.room.isModerator()) {
logger.error(`Cannot send participant to room - supported:${this.isSupported()},
logger.error(`Cannot send participant to room - supported:${this.isSupported()},
moderator:${this.room.isModerator()}`);

return;
Expand Down

0 comments on commit 2d7f0ab

Please sign in to comment.