From 41fedf860ef0d2ae8ab66777a2d60ac8bdc5c184 Mon Sep 17 00:00:00 2001 From: Werner Fleischer <70745309+wernf@users.noreply.github.com> Date: Fri, 24 Dec 2021 09:30:08 +0100 Subject: [PATCH] feat(breakout-rooms): moderation of visibility --- modules/xmpp/BreakoutRooms.js | 22 ++++++++++++++++++++++ modules/xmpp/xmpp.js | 7 +++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/xmpp/BreakoutRooms.js b/modules/xmpp/BreakoutRooms.js index 7c73be5a6f..92f2f181c8 100644 --- a/modules/xmpp/BreakoutRooms.js +++ b/modules/xmpp/BreakoutRooms.js @@ -7,6 +7,7 @@ const FEATURE_KEY = 'features/breakout-rooms'; const BREAKOUT_ROOM_ACTIONS = { ADD: `${FEATURE_KEY}/add`, MOVE_TO_ROOM: `${FEATURE_KEY}/move-to-room`, + PUBLISH: `${FEATURE_KEY}/publish`, REMOVE: `${FEATURE_KEY}/remove`, RENAME: `${FEATURE_KEY}/rename` }; @@ -108,6 +109,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. * diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js index 6a70c788cb..55dc7782f7 100644 --- a/modules/xmpp/xmpp.js +++ b/modules/xmpp/xmpp.js @@ -419,8 +419,8 @@ export default class XMPP extends Listenable { /** * Process received identities. * @param {Set} identities The identities to process. - * @param {Set} features The features to process, optional. If missing lobby component will be queried - * for more features. + * @param {Set} features The features to process, optional. If missing lobby and breakout rooms + * components will be queried for more features. * @private */ _processDiscoInfoIdentities(identities, features) { @@ -483,6 +483,9 @@ export default class XMPP extends Listenable { if (fr.endsWith('#rename')) { this.breakoutRoomsFeatures.rename = true; } + if (fr.endsWith('#publish')) { + this.breakoutRoomsFeatures.publish = true; + } }); };