Skip to content

feat: extend audio groups to cameras and screen sharing - #24427

Merged
prlanzarin merged 5 commits into
bigbluebutton:v3.0.x-developfrom
prlanzarin:u30/feat/media-groups
Mar 23, 2026
Merged

prlanzarin merged 5 commits into
bigbluebutton:v3.0.x-developfrom
prlanzarin:u30/feat/media-groups

Conversation

@prlanzarin

@prlanzarin prlanzarin commented Jan 9, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

  • feat: extend audio groups to cameras and screen sharing
    • Real-time media components currently rely on participant "meshing," where
      all participants see and hear each other. This prevents use cases requiring
      asymmetric media relationships, such as proctoring, huddles, or embedded
      breakout rooms. While audio groups exist for audio asymmetry, cameras and
      screen sharing lack a similar mechanism.
    • Extend the audio groups mechanism to support cameras and RTC content,
      renaming the feature to "MediaGroups." A MediaGroup is a logical unit
      defined by an identifier, creator ID, media type, lock status, and lists
      of broadcasters and viewers.
    • Groups have the following business logic:
      • Broadcasters' streams are only visible to viewers of that group.
      • Viewers filter visible streams to show only group broadcasters.
      • Users can participate in multiple groups simultaneously in any capacity.
      • Absence of a group assignment defaults to the "public" space.
      • Locked groups are restricted to moderator manipulation.
    • Expose actions to manipulate groups to clients via GraphQL mutations.
      The recorded attribute is included in the MediaGroup structure for future
      use, though its functionality is not yet implemented.
  • feat: add explicit public groups to the media groups mechanism
    • Virtual public groups are not sufficient when participants must hear/see
      an union of users who are in public (i.e.: no groups) and ones that are
      in specific media groups. This is by definition, since treating public
      groups as the "absence of groups" makes things mutually exclusive here.
    • Add explicit, reserved public groups for the basic media types: audio,
      camera and screenshare. All of them have static IDs
      public:${mediaType}, and cannot be destroyed nor altered in their
      base structure by any user.
  • refactor: replace media group's join/leave/update with declarative setUserMediaGroupState
    • The media groups API uses three separate imperative operations (join,
      leave, update) to change user media group membership. Multi-group state
      transitions required chaining these operations sequentially, while
      ordering cannot be reliably guaranteed by neither server or clients.
      This creates race conditions where users can end up in inconsistent states
      across audio, video and screen sharing groups.
    • Replace the join/leave/update media group APIs with a single declarative
      setUserMediaGroupState API. The client declares their desired media
      group state with a varying degree or specificity via the scope
      parameter.

Closes Issue(s)

None

Motivation

Read above/commit log

@coderabbitai

coderabbitai Bot commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

This pull request systematically replaces the AudioGroups feature with a new MediaGroups system. Removed are the entire audio group handling layer (handlers, data models, persistence, messaging, recording events, GraphQL actions) spanning Scala backend, TypeScript GraphQL actions, frontend React components, and database schema. Added are corresponding media group equivalents with significant enhancements: media groups now include mediaType (audio, camera, screenshare), locked/record flags, and participant role representation shifted from participantType enum to sender/receiver boolean flags. A new SetUserMediaGroupStateReqMsg replaces the previous join/leave/update participant flows. The system introduces public media groups (initialized on meeting startup) and persists groups/participants through new MediaGroupDAO and MediaGroupUserDAO. Message routing, database schema, GraphQL mutations, and frontend subscriptions are updated throughout to support the new model.

Sequence Diagram(s)

sequenceDiagram
    actor Client
    participant MsgRouter as Message Router
    participant Handler as SetUserMediaGroupStateReqMsgHdlr
    participant App as MediaGroupApp
    participant DB as MediaGroupDAO/<br/>MediaGroupUserDAO
    participant Broadcast as Event Bus

    Client->>MsgRouter: SetUserMediaGroupStateReqMsg<br/>(userId, entries, scope)
    MsgRouter->>Handler: handle(msg, state, liveMeeting, bus)
    Handler->>Handler: Check permissions<br/>(isModerator, locked groups)
    Handler->>App: setUserMediaGroupState(userId, entries, scope, state.mediaGroups)
    App->>App: Deduplicate & validate entries<br/>against current groups
    alt Entry valid
        App->>App: Compute additions/updates/removals per scope
        App->>DB: Persist participant changes
        App->>App: enrollUserInPublicGroups() if needed
        App->>Broadcast: handleMediaGroupUpdated(affectedGroup)
        Broadcast->>Client: MediaGroupUpdated events
    else Errors
        App-->>Handler: return appliedState + errors
    end
    App-->>Handler: SetUserMediaGroupStateResult
    Handler->>Broadcast: Send SetUserMediaGroupStateRespMsg(userId, appliedState, errors)
    Broadcast->>Client: Response with applied state/errors
    Handler-->>MsgRouter: Updated MeetingState2x (mediaGroups)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: extending the audio groups mechanism to support multiple media types (cameras and screen sharing), which aligns with the core objective of renaming AudioGroups to MediaGroups.
Description check ✅ Passed The description comprehensively explains the motivation, implementation, and business logic for the PR. It references the key features: MediaGroups extension for multiple media types, explicit public groups, and replacement of imperative APIs with declarative setUserMediaGroupState.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1)

153-155: Fix retry backoff calculation (comma operator makes multiplier a no-op).
Line 153-155 currently computes a ** (b, attempts) which evaluates as a ** attempts in JS (comma operator), ignoring BACKOFF_MULTIPLIER. This changes retry behavior and can cause overly aggressive retries.

Proposed fix
-    const delay = SUBSCRIPTION_RETRY.RETRY_INTERVAL
-      ** (SUBSCRIPTION_RETRY.BACKOFF_MULTIPLIER, attempts);
+    // Typical exponential backoff: baseInterval * multiplier^attempts
+    const delay =
+      SUBSCRIPTION_RETRY.RETRY_INTERVAL *
+      (SUBSCRIPTION_RETRY.BACKOFF_MULTIPLIER ** attempts);
bbb-graphql-server/bbb_schema.sql (1)

2630-2644: High blast-radius: marking all v_% view columns ending with Id as NOT NULL can break Hasura schema/runtime.
Many view columns ending in Id are legitimately nullable (e.g., “deletedByUserId”-style fields, optional FKs). If Hasura treats them as non-null and encounters NULL at runtime, clients can see query failures. Strongly suggest scoping this update to a curated allowlist of known-safe columns/views.

🤖 Fix all issues with AI agents
In
@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala:
- Line 59: The broadcastEvent(mg) call is sending the old media group state
before the new participant is added; move or remove that call so the broadcast
happens only after the participant is appended to mg (i.e., call broadcastEvent
with the updated mg after the add-participant logic), or drop the early
broadcast if handleMediaGroupUpdated already emits the updated event—ensure only
the post-addition media-group object is passed to broadcastEvent and/or rely
solely on handleMediaGroupUpdated to avoid duplicate broadcasts.

In
@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala:
- Around line 45-57: broadcastEvent(mg) is called with the pre-update
MediaGroup, so the emitted MediaGroupParticipantsAddedEvtMsgBody won’t include
the newly added senders/receivers; replace the broadcast of the old group with
broadcasting the updated group returned by
MediaGroupApp.addMediaGroupParticipants (i.e., use updatedGroups or the updated
MediaGroup instance) before calling MediaGroupApp.handleMediaGroupUpdated and
returning newState; update any references to mg in the subsequent calls to use
the updated group id/object as needed.

In
@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala:
- Around line 38-68: The current addSenders/addReceivers and
addMediaGroupParticipant logic can create duplicates because
MediaGroupParticipant equality includes flags, not just userId; change the add
paths to normalize by userId: when adding a sender or receiver (in
addSenders/addReceivers and addSender/addReceiver usage inside
addMediaGroupParticipant), first remove any existing participant(s) with the
same MediaGroupParticipant.userId from the target set, then add the new
participant(s). Concretely, update addMediaGroupParticipants to dedupe by
mapping incoming senders/receivers by userId (or filtering existing
mg.senders/mg.receivers to drop matching userIds) before calling
mg.addSenders/addReceivers, and similarly in addMediaGroupParticipant ensure you
drop any existing entries with participant.userId from mg.senders or
mg.receivers before calling mg.addSender/addReceiver so each userId appears at
most once per role.

In
@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupRemoveParticipantsReqMsgHdlr.scala:
- Around line 30-31: The logic for affectsOtherUsers is inverted: instead of
checking whether the requester's ID is in the removal list
(userIds.contains(msg.header.userId)), change it to check whether the removal
list contains any ID different from the requester (e.g., use userIds.exists(_ !=
msg.header.userId)) so affectsOtherUsers is true when others are being removed;
update the assignment of affectsOtherUsers accordingly in
MediaGroupRemoveParticipantsReqMsgHdlr where userIds and msg.header.userId are
used.

In
@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala:
- Around line 15-24: The Slick table mapping in MediaGroupUserDbTableDef defines
the active column as non-nullable Boolean (val active =
column[Boolean]("active")) while the DB allows NULL, causing runtime mapping
failures; either change the Slick column to Option[Boolean] (val active =
column[Option[Boolean]]("active")) and update the mapping in the override def *
tuple to use MediaGroupUserDbModel's optional field (or adapt
MediaGroupUserDbModel to accept Option[Boolean]), or enforce NOT NULL DEFAULT
false in the DB schema for "user_mediaGroup"."active" so the existing
MediaGroupUserDbModel.tupled mapping remains valid; apply the same change to the
other table/class referenced around lines 90-98.

In
@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala:
- Around line 26-43: The Set[MediaGroupParticipant] may accumulate multiple
entries with the same userId because equality isn’t based on userId; update
addSender, addSenders, addReceiver, and addReceivers to normalize by userId by
removing any existing participant(s) with the same userId before inserting the
new one(s) (e.g., filter out by userId then add the new participant(s)), and
consider normalizing in the primary constructor or a private helper to ensure
any incoming collections are de-duplicated by userId as well.

In @bbb-graphql-actions/src/actions/mediaGroupLeave.ts:
- Around line 4-16: buildRedisMessage currently casts
sessionVariables['x-hasura-meetingid'] and ['x-hasura-userid'] to string without
verifying they exist, which can let undefined through; before constructing
routing and headers, call throwErrorIfInvalidInput (or add explicit checks) to
validate that sessionVariables contains 'x-hasura-meetingid' and
'x-hasura-userid' (and any other x-hasura-* keys used later around lines 24–31),
and throw a clear error if missing so routing/header values are guaranteed
non-undefined when you use them in routing and headers.

In @bbb-graphql-server/metadata/actions.yaml:
- Around line 34-41: Update the grammar in the action comments by replacing "an
user" with "a user" in the YAML comment fields (e.g., the comment that currently
reads "Joins an user to a MediaGroup" and the comment for the action
mediaGroupLeave that reads "Removes an user from a MediaGroup"); ensure both
comment strings are changed to "a user" to correct the articles.
🧹 Nitpick comments (14)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupDestroyedRecordEvent.scala (1)

9-11: Unused constant SENDERS in companion object.

The SENDERS constant is defined but never used in MediaGroupDestroyedRecordEvent. Unlike MediaGroupCreatedRecordEvent and MediaGroupUpdatedRecordEvent, this class doesn't have a setSenders method, and handleMediaGroupDestroyedEvtMsg in RedisRecorderActor.scala doesn't call one either.

Consider removing it to avoid dead code:

♻️ Suggested fix
-object MediaGroupDestroyedRecordEvent {
-  protected final val SENDERS = "senders"
-}
+object MediaGroupDestroyedRecordEvent
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupUpdatedRecordEvent.scala (1)

5-13: LGTM!

The implementation correctly filters active participants and records their user IDs.

Note: The setSenders method is identical to the one in MediaGroupCreatedRecordEvent. If you expect more event types to need this functionality, consider extracting it to AbstractMediaGroupRecordEvent. However, this is minor and can be deferred.

bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/queries.ts (1)

16-30: Keep query/subscription selections consistent (and consider a shared fragment)

The field sets are almost identical but not quite (subscription includes userId, query doesn’t). If downstream logic expects the same shape from both paths, consider aligning them (or extracting a fragment) to reduce drift.

bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (2)

3-3: Minor formatting inconsistency.

Missing space before = in CAMERA= 'camera', inconsistent with other enum values.

Suggested fix
-  CAMERA= 'camera',
+  CAMERA = 'camera',

7-23: Consider consolidating duplicate type structures.

MediaGroupParticipant and MediaGroupStream have identical fields. If they serve the same purpose, consider using a single type or creating a base type.

Example consolidation
export type MediaGroupEntry = {
  userId: string;
  groupId: string;
  mediaType: MediaType;
  sender: boolean;
  receiver: boolean;
  active: boolean;
};

export type MediaGroupParticipant = MediaGroupEntry;
export type MediaGroupStream = MediaGroupEntry;

If they are intentionally separate for semantic clarity or future divergence, this is fine as-is.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/MeetingState2x.scala (1)

4-5: Clean AudioGroups → MediaGroups swap in MeetingState2x.

If you want to avoid shadowing (minor readability), consider:

Optional rename
-  def update(mediaGroups: MediaGroups): MeetingState2x = copy(mediaGroups = mediaGroups)
+  def update(updatedMediaGroups: MediaGroups): MeetingState2x = copy(mediaGroups = updatedMediaGroups)

Also applies to: 10-19, 34-35

bbb-graphql-actions/src/actions/mediaGroupUpdateParticipant.ts (1)

13-25: Add validation to prevent no-op participants with both sender and receiver set to false.

The event name 'MediaGroupUpdateParticipantReqMsg' is correct and matches the backend handler. However, the backend has no validation preventing a participant from having both sender and receiver set to false, which would create an invalid state. Add a check before sending the update:

   const participant = input['participant'] as Record<string, unknown>;

   throwErrorIfInvalidInput(participant, [
     { name: 'userId', type: 'string', required: true },
     { name: 'sender', type: 'boolean', required: true },
     { name: 'receiver', type: 'boolean', required: true },
     { name: 'active', type: 'boolean', required: true },
   ]);
+
+  if (!(participant.sender as boolean) && !(participant.receiver as boolean)) {
+    throw new Error("participant must have at least one of 'sender' or 'receiver' set to true");
+  }
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala (1)

54-65: Potential duplicate DB inserts when participants overlap senders and receivers.

If a participant is both a sender and receiver (present in both lists), insertParticipants will call MediaGroupUserDAO.insert twice for the same user. Based on the MediaGroupUserDAO.insertUser implementation (which uses insertOrUpdate), this should be safe but results in redundant DB operations.

Consider deduplicating participants before insertion:

♻️ Suggested optimization
      def insertParticipants(
          senders:   Vector[MediaGroupParticipant],
          receivers: Vector[MediaGroupParticipant],
          mgId:      String
      ): Unit = {
-        senders.foreach { sender =>
-          MediaGroupUserDAO.insert(liveMeeting.props.meetingProp.intId, mgId, sender)
-        }
-        receivers.foreach { receiver =>
-          MediaGroupUserDAO.insert(liveMeeting.props.meetingProp.intId, mgId, receiver)
-        }
+        val allParticipants = (senders ++ receivers).distinctBy(_.userId)
+        allParticipants.foreach { participant =>
+          MediaGroupUserDAO.insert(liveMeeting.props.meetingProp.intId, mgId, participant)
+        }
      }
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupDAO.scala (1)

25-48: Consider adding an update method for future MediaGroup field modifications.

The DAO currently only supports insert and delete. Per the PR summary, locked and record attributes are included for future use. When these become mutable, an update method will be needed.

This is a minor consideration for future extensibility - no immediate action needed.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala (1)

38-44: Redundant permission checks - can be simplified.

The permissionFailed call is duplicated with identical parameters. This can be consolidated:

♻️ Simplified permission check
-        if ((mg.locked && permissionFailed(
-          PermissionCheck.MOD_LEVEL,
-          PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId
-        )) || (affectsOtherUser && permissionFailed(
-            PermissionCheck.MOD_LEVEL,
-            PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId
-          ))) {
+        val needsModPermission = mg.locked || affectsOtherUser
+        if (needsModPermission && permissionFailed(
+          PermissionCheck.MOD_LEVEL,
+          PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId
+        )) {
bbb-graphql-server/metadata/actions.graphql (1)

10-17: Consider documenting valid mediaType values.

The mediaType parameter accepts any String!, but per the MediaGroup model, valid values are: audio, camera, screenshare. Consider adding a comment or using an enum for type safety.

This could be addressed by defining a GraphQL enum:

enum MediaType {
  audio
  camera
  screenshare
}
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1)

126-185: Retry timers lack cleanup on unmount (possible leaks + state updates after unmount).
retryMap timers can keep firing after the component tree changes; consider clearing all timers in a cleanup effect.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (1)

122-139: Event attribution: avoid using mg.createdBy as the “sender” for update broadcasts.
Line 132-136 use mg.createdBy for routing/header. That misattributes updates performed by moderators/others and can affect client-side reconciliation or auditing. Consider passing requesterId into handleMediaGroupUpdated and using it for routing/header.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (1)

15-17: Simplify findAllMediaGroupsForUser predicate (transceiving is redundant).
isUserTransceiving(id) implies both isUserReceiving and isUserSending; checking all three is unnecessary.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 83092a4 and 46fc174.

📒 Files selected for processing (55)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupRemoveParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/CreateAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/DestroyAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/GetAudioGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/JoinAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/LeaveAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/LeaveMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupRemoveParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupUpdateParticipantReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/AudioGroupDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/MeetingState2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/AudioGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractAudioGroupRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractMediaGroupRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/AudioGroupsMsgs.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala
  • bbb-graphql-actions/src/actions/audioGroupCreate.ts
  • bbb-graphql-actions/src/actions/mediaGroupCreate.ts
  • bbb-graphql-actions/src/actions/mediaGroupDestroy.ts
  • bbb-graphql-actions/src/actions/mediaGroupJoin.ts
  • bbb-graphql-actions/src/actions/mediaGroupLeave.ts
  • bbb-graphql-actions/src/actions/mediaGroupUpdateParticipant.ts
  • bbb-graphql-server/bbb_schema.sql
  • bbb-graphql-server/metadata/actions.graphql
  • bbb-graphql-server/metadata/actions.yaml
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_mediaGroup.yaml
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_mediaGroup.yaml
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/tables.yaml
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/component.tsx
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/queries.ts
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts
  • bigbluebutton-html5/imports/ui/components/video-provider/hooks/index.ts
💤 Files with no reviewable changes (16)
  • bbb-graphql-actions/src/actions/audioGroupCreate.ts
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/AudioGroupDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/GetAudioGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupRemoveParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/LeaveAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractAudioGroupRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/DestroyAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/CreateAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/JoinAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/AudioGroups.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/AudioGroupsMsgs.scala
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-10-10T12:15:03.265Z
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.

Applied to files:

  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/MeetingState2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupUpdateParticipantReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala
🧬 Code graph analysis (21)
bbb-graphql-actions/src/actions/mediaGroupCreate.ts (6)
bbb-graphql-actions/src/actions/mediaGroupDestroy.ts (1)
  • buildRedisMessage (4-29)
bbb-graphql-actions/src/actions/mediaGroupJoin.ts (1)
  • buildRedisMessage (4-40)
bbb-graphql-actions/src/actions/mediaGroupLeave.ts (1)
  • buildRedisMessage (4-31)
bbb-graphql-actions/src/actions/mediaGroupUpdateParticipant.ts (1)
  • buildRedisMessage (4-40)
bbb-graphql-middleware/internal/common/types.go (1)
  • RedisMessage (99-108)
bbb-graphql-actions/src/imports/validation.ts (2)
  • throwErrorIfInvalidInput (29-126)
  • InputParam (23-27)
bbb-graphql-actions/src/actions/mediaGroupJoin.ts (1)
bbb-graphql-actions/src/imports/validation.ts (1)
  • throwErrorIfInvalidInput (29-126)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/MeetingState2x.scala (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (2)
  • MediaGroups (5-18)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupUpdatedRecordEvent.scala (3)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (1)
  • MediaGroupParticipant (4-9)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (1)
  • MediaGroupParticipant (7-14)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala (1)
  • setSenders (10-12)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala (4)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (2)
  • MediaGroup (20-56)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupDAO.scala (2)
  • MediaGroupDAO (25-49)
  • delete (41-48)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (3)
  • MediaGroupApp (7-148)
  • findMediaGroup (30-32)
  • deleteMediaGroup (34-36)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (3)
  • MediaGroupDestroyedEvtMsg (63-63)
  • MediaGroupDestroyedEvtMsg (64-64)
  • MediaGroupDestroyedEvtMsgBody (65-65)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/component.tsx (2)
bigbluebutton-html5/imports/ui/services/livekit/index.ts (1)
  • liveKitRoom (12-12)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1)
  • useMediaSubscriptions (115-298)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupRemoveParticipantsReqMsgHdlr.scala (3)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (2)
  • MediaGroup (20-56)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala (1)
  • handle (13-61)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (3)
  • MediaGroupParticipantsRemovedEvtMsg (102-102)
  • MediaGroupParticipantsRemovedEvtMsg (103-103)
  • MediaGroupParticipantsRemovedEvtMsgBody (104-109)
bigbluebutton-html5/imports/ui/components/video-provider/hooks/index.ts (2)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/queries.ts (1)
  • MEDIA_GROUP_STREAMS_SUBSCRIPTION (3-14)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (1)
  • MediaGroupStream (16-23)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (2)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (1)
  • MediaGroupParticipant (4-9)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (1)
  • MediaGroupParticipant (7-14)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala (5)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (4)
  • MediaGroup (20-56)
  • findAllSenders (31-31)
  • findAllReceivers (36-36)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala (4)
  • MediaGroupUserDAO (26-99)
  • groupId (22-22)
  • insert (27-29)
  • update (46-55)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala (2)
  • handle (14-53)
  • broadcastEvent (17-29)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala (2)
  • handle (13-61)
  • broadcastEvent (16-28)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (7)
  • broadcastEvent (128-140)
  • MediaGroupApp (7-148)
  • findMediaGroup (30-32)
  • addMediaGroupParticipants (38-51)
  • handleMediaGroupUpdated (122-147)
  • createMediaGroup (8-21)
  • addMediaGroup (23-28)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (1)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (1)
  • MediaGroupParticipant (4-9)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (2)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/queries.ts (1)
  • MEDIA_GROUP_STREAMS_SUBSCRIPTION (3-14)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (2)
  • MediaSendersData (25-28)
  • MediaGroupStream (16-23)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/LeaveMediaGroupReqMsgHdlr.scala (3)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (3)
  • MediaGroup (20-56)
  • findParticipant (49-51)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala (4)
  • MediaGroupUserDAO (26-99)
  • groupId (22-22)
  • delete (57-65)
  • update (46-55)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (5)
  • broadcastEvent (128-140)
  • MediaGroupApp (7-148)
  • findMediaGroup (30-32)
  • removeMediaGroupParticipant (98-110)
  • handleMediaGroupUpdated (122-147)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala (4)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (3)
  • MediaGroup (20-56)
  • findParticipant (49-51)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala (4)
  • MediaGroupUserDAO (26-99)
  • groupId (22-22)
  • insertUser (31-44)
  • update (46-55)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (5)
  • broadcastEvent (128-140)
  • MediaGroupApp (7-148)
  • findMediaGroup (30-32)
  • addMediaGroupParticipant (53-68)
  • handleMediaGroupUpdated (122-147)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (3)
  • MediaGroupParticipantJoinedEvtMsg (119-119)
  • MediaGroupParticipantJoinedEvtMsg (120-120)
  • MediaGroupParticipantJoinedEvtMsgBody (121-125)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala (3)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/MeetingState2x.scala (2)
  • MeetingState2x (6-8)
  • MeetingState2x (10-36)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (4)
  • MediaGroupInfo (11-19)
  • GetMediaGroupsRespMsg (71-71)
  • GetMediaGroupsRespMsg (72-72)
  • GetMediaGroupsRespMsgBody (73-73)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (3)
  • findAllSenders (31-31)
  • findAllReceivers (36-36)
  • findAllMediaGroups (14-14)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala (1)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (16)
  • GetMediaGroupsReqMsg (67-67)
  • GetMediaGroupsReqMsg (68-68)
  • CreateMediaGroupReqMsg (21-21)
  • CreateMediaGroupReqMsg (22-22)
  • DestroyMediaGroupReqMsg (56-56)
  • DestroyMediaGroupReqMsg (57-57)
  • MediaGroupAddParticipantsReqMsg (75-75)
  • MediaGroupAddParticipantsReqMsg (76-76)
  • MediaGroupRemoveParticipantsReqMsg (94-94)
  • MediaGroupRemoveParticipantsReqMsg (95-95)
  • JoinMediaGroupReqMsg (111-111)
  • JoinMediaGroupReqMsg (112-112)
  • LeaveMediaGroupReqMsg (127-127)
  • LeaveMediaGroupReqMsg (128-128)
  • MediaGroupUpdateParticipantReqMsg (144-144)
  • MediaGroupUpdateParticipantReqMsg (145-145)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (3)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (15)
  • add (7-9)
  • find (6-6)
  • remove (10-10)
  • addSenders (30-30)
  • addReceivers (35-35)
  • update (11-13)
  • addSender (29-29)
  • addReceiver (34-34)
  • updateParticipant (39-43)
  • removeSenders (33-33)
  • removeParticipant (44-48)
  • findAllMediaGroups (14-14)
  • removeSender (32-32)
  • findAllSenders (31-31)
  • findAllReceivers (36-36)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala (1)
  • update (46-55)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (3)
  • MediaGroupUpdatedEvtMsg (44-44)
  • MediaGroupUpdatedEvtMsg (45-45)
  • MediaGroupUpdatedEvtMsgBody (46-54)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala (4)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (1)
  • MediaGroupParticipant (4-9)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (1)
  • MediaGroupParticipant (7-14)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupDAO.scala (2)
  • insert (26-39)
  • delete (41-48)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (1)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala (3)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala (1)
  • MediaGroupHdlrs (6-17)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala (1)
  • handle (24-99)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala (1)
  • handle (11-42)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala (6)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (4)
  • MediaGroup (20-56)
  • findAllSenders (31-31)
  • findAllReceivers (36-36)
  • update (11-13)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala (1)
  • handle (11-42)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala (2)
  • handle (14-76)
  • broadcastEvent (22-34)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupUpdateParticipantReqMsgHdlr.scala (2)
  • handle (14-66)
  • broadcastEvent (22-34)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (3)
  • broadcastEvent (128-140)
  • MediaGroupApp (7-148)
  • findMediaGroup (30-32)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (3)
  • MediaGroupParticipantsAddedEvtMsg (84-84)
  • MediaGroupParticipantsAddedEvtMsg (85-85)
  • MediaGroupParticipantsAddedEvtMsgBody (86-92)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (2)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts (1)
  • MediaGroupParticipant (7-14)
bigbluebutton-html5/imports/ui/components/audio/service.js (1)
  • userId (89-89)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-apps-akka)
  • GitHub Check: build-package (bbb-graphql-server)
🔇 Additional comments (39)
akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala (2)

110-112: LGTM!

The dispatch cases correctly route the new MediaGroup*EvtMsg messages to their respective handlers, following the established pattern in this actor.


546-570: LGTM!

The three MediaGroup handlers follow the established pattern in this actor:

  • handleMediaGroupCreatedEvtMsg and handleMediaGroupUpdatedEvtMsg correctly record senders.
  • handleMediaGroupDestroyedEvtMsg appropriately omits senders since the group is being destroyed.
  • All handlers consistently set groupId and mediaType.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala (1)

5-13: LGTM!

The class correctly extends AbstractMediaGroupRecordEvent, sets the appropriate event name, and provides a setSenders method that properly filters for active participants before recording their user IDs.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractMediaGroupRecordEvent.scala (1)

3-20: LGTM!

Clean base trait that establishes the MEDIA_GROUP module and provides common setGroupId and setMediaType methods for all derived media group record events. The design follows existing patterns in the codebase.

bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/queries.ts (1)

3-14: This review comment is based on incorrect assumptions. The MEDIA_GROUP_STREAMS_SUBSCRIPTION uses patched subscriptions with Apollo's fetchPolicy: 'no-cache', which completely bypasses cache normalization. Cache identity drift is not a concern in this context. Additionally, no evidence of a participantType → mediaType/sender/receiver field rename exists in the codebase, and no references to the old constants remain.

Likely an incorrect or invalid review comment.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupUpdateParticipantReqMsgHdlr.scala (1)

46-65: LGTM!

The update flow is correctly structured: lookup group → verify participant exists → update state → broadcast event → persist to DB → propagate state changes. Silent state return on failure cases aligns with typical BBB handler patterns.

bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_mediaGroup.yaml (1)

1-42: LGTM!

The metadata correctly exposes the new sender, receiver, and mediaType fields while maintaining proper relationship mappings and permission filters.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala (1)

97-113: LGTM!

The analytics logging comprehensively covers all MediaGroup message types, maintaining consistency with the existing logging patterns for other message categories.

bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/component.tsx (1)

5-9: LGTM!

The hook migration from useAudioSubscriptions to useMediaSubscriptions is correctly applied. Component logic and behavior remain unchanged.

bbb-graphql-server/metadata/databases/BigBlueButton/tables/tables.yaml (1)

1-1: LGTM!

The include references are correctly updated to point to the renamed MediaGroup metadata files.

Also applies to: 55-55

bbb-graphql-actions/src/actions/mediaGroupDestroy.ts (1)

5-8: Validate mediaType against allowed enum values, but the validation utility doesn't currently support enum checks.

The concern is valid: mediaType is only validated as a string, allowing invalid values like "invalid" to pass. However, the suggested fix with enum: ['audio', 'camera', 'screenshare'] won't work because throwErrorIfInvalidInput doesn't support enum validation. The InputParam type only defines: 'string' | 'number' | 'int' | 'boolean' | 'json' | 'jsonArray' | 'stringArray' | 'numberArray' | 'intArray' | 'objectArray'.

Either extend the validation utility to support enum checks or validate mediaType manually after the throwErrorIfInvalidInput call.

bbb-graphql-actions/src/actions/mediaGroupLeave.ts (1)

5-9: Looks consistent with the MediaGroup migration (mediaType propagation + event rename).

Also applies to: 11-16, 24-28

bbb-graphql-actions/src/actions/mediaGroupUpdateParticipant.ts (1)

5-9: MediaType + new { userId, sender, receiver, active } participant shape is coherent.

Also applies to: 13-18, 20-37

bbb-graphql-actions/src/actions/mediaGroupJoin.ts (2)

5-9: Join action updates are consistent (mediaType + send/receive flags + event rename).

Also applies to: 13-20, 22-37


4-25: Message name 'JoinMediaGroupReqMsg' is correct. The backend handler JoinMediaGroupReqMsgHdlr is properly defined. However, the suggestion to apply "same hardening as updateParticipant" is not applicable—mediaGroupUpdateParticipant.ts does not contain routing variable validation or rejection of {sender:false, receiver:false} logic. Both files have identical validation patterns with no such additional hardening in place.

Likely an incorrect or invalid review comment.

bbb-graphql-actions/src/actions/mediaGroupCreate.ts (2)

1-47: Nice, compact CreateMediaGroup action with per-sender/receiver validation and sane defaults.


5-12: No action needed—field naming is consistent across all layers.

The backend message definitions (CreateMediaGroupReqMsgBody and MediaGroupCreatedEvtMsgBody) both use record (not recorded), which matches the GraphQL action at lines 5–12 and 41. The handler correctly passes mg.record to the event body. No mismatch exists between the GraphQL action and backend expectations.

Additionally, sessionVariables are properly validated and used within the routing object (lines 26–29); no undefined values are silently propagated.

bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_mediaGroup.yaml (1)

1-31: LGTM!

The metadata changes correctly expose the new MediaGroup fields (mediaType, locked, record, createdBy) while maintaining appropriate row-level security filtering by meetingId. The renaming from audioGroup to mediaGroup is consistent with the PR objectives.

bigbluebutton-html5/imports/ui/components/video-provider/hooks/index.ts (3)

54-60: LGTM!

The new imports for media group subscription and types are correctly added and align with the selective-subscription module definitions.


398-443: LGTM!

The useVideoSenders hook correctly implements the media group filtering logic:

  • When the user is a receiver in any group (inAnyGroup: true), it returns senderIds from those groups
  • When the user is not in any group, it returns senderIdsInGroups to identify streams that should be excluded from the public space

The error handling for subscription failures is appropriate with structured logging.


463-471: LGTM!

The stream filtering logic correctly implements the media group visibility rules:

  • When inAnyGroup is true: shows only local streams and streams from senders in the user's groups
  • When only senderIdsInGroups exists: shows local streams and streams from users not exclusively broadcasting to groups (public space)

This aligns with the PR business rule that broadcasters' streams are only visible to viewers of the same group.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala (1)

1-43: LGTM!

The handler correctly implements a read-only query to fetch all media groups:

  • The buildMediaGroupInfo helper properly maps the MediaGroup model to MediaGroupInfo DTO
  • Uses DIRECT routing to respond only to the requesting user
  • Returns state unchanged as this is a pure read operation

The absence of a permission check appears intentional, allowing any meeting participant to query available groups.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/LeaveMediaGroupReqMsgHdlr.scala (1)

1-69: LGTM!

The handler correctly implements the leave media group flow:

  • Permission validation ensures only moderators can leave locked groups or remove other users
  • The participant is removed from the in-memory state via MediaGroupApp.removeMediaGroupParticipant
  • Database state is synchronized via MediaGroupUserDAO.delete
  • Both MediaGroupParticipantLeftEvtMsg and MediaGroupUpdatedEvtMsg are broadcast to notify clients

The permission check logic properly handles both the locked group case and the "affecting other user" case with appropriate moderator-level validation.

bbb-graphql-server/metadata/actions.yaml (1)

14-48: LGTM on the action and type renames.

The renaming from audioGroup* to mediaGroup* actions and AudioGroupParticipant to MediaGroupParticipant is consistent across all definitions.

Also applies to: 668-668

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala (1)

1-17: LGTM!

The MediaGroupHdlrs class cleanly aggregates all eight media group handler traits using Scala's mixin composition. The logging setup via Pekko's Logging is correctly initialized with the actor context.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupRemoveParticipantsReqMsgHdlr.scala (1)

44-56: Missing handleMediaGroupUpdated call and DB persistence.

Compared to LeaveMediaGroupReqMsgHdlr, this handler:

  1. Does not call MediaGroupApp.handleMediaGroupUpdated to broadcast the updated group state to clients
  2. Does not persist the removal to the database via MediaGroupUserDAO.delete

This inconsistency means clients won't receive the MediaGroupUpdatedEvtMsg and the database will become out of sync with in-memory state.

🔧 Proposed fix
 case Some(mg) =>
   val updatedGroups = MediaGroupApp.removeMediaGroupParticipants(
     groupId,
     userIds,
     state.mediaGroups
   )
   broadcastEvent(mg)
-  // TODO: No DB for now - will be used later
-  state.update(updatedGroups)
+  userIds.foreach { userId =>
+    MediaGroupUserDAO.delete(liveMeeting.props.meetingProp.intId, groupId, userId)
+  }
+  val newState = state.update(updatedGroups)
+  MediaGroupApp.handleMediaGroupUpdated(mg.id, updatedGroups, liveMeeting, bus.outGW)
+  newState
 case None =>
   state

Note: You'll also need to add the import for MediaGroupUserDAO:

import org.bigbluebutton.core.db.MediaGroupUserDAO
⛔ Skipped due to learnings
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala (2)

67-80: When group exists, participants are added but duplicates may not be detected.

When the target media group already exists, addMediaGroupParticipants is called to update in-memory state. However, the broadcast uses handleMediaGroupUpdated which notifies about the updated state, but there's no early return or duplicate check before persisting to the database. If the same participant is added multiple times, the DB call succeeds silently due to insertOrUpdate, but the logic could be clearer.


82-96: LGTM - New group creation path is well-structured.

The creation flow correctly:

  1. Creates the MediaGroup via MediaGroupApp.createMediaGroup
  2. Adds to in-memory state
  3. Broadcasts the created event
  4. Persists to MediaGroupDAO and MediaGroupUserDAO
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala (2)

44-48: LGTM - Deletion sequence is appropriate.

The deletion follows the correct order: update in-memory state first, broadcast event, then clean up persistence. This ensures clients are notified promptly while maintaining consistency.


35-42: Permission logic for destroying locked media groups is inconsistent with other handlers.

The condition at line 38 uses a different pattern than Join/Leave handlers:

  • Destroy: permissionFailed(...) || (mg.locked && mg.createdBy != msg.header.userId)
  • Join/Leave: (mg.locked && permissionFailed(...))

This means a moderator can join/leave a locked group they don't own, but cannot destroy it—they'll be ejected. If moderators should have full control over locked groups, the condition should match the Join/Leave pattern:

if ((mg.locked && permissionFailed(
  PermissionCheck.MOD_LEVEL,
  PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId
)))
⛔ Skipped due to learnings
Learnt from: jaapjansma
Repo: bigbluebutton/bigbluebutton PR: 21204
File: bbb-common-web/src/main/scala/org/bigbluebutton/api2/meeting/MeetingsManagerActor.scala:21-21
Timestamp: 2024-10-10T12:15:03.265Z
Learning: When reviewing code changes in BigBlueButton, particularly in case classes like `RegisterUser` in `MeetingsManagerActor.scala`, ensure to accurately distinguish between added parameters and replaced parameters to avoid incorrect assessments.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupDAO.scala (1)

14-23: LGTM - Table definition is correct for composite primary key.

The Slick table definition properly maps all fields and uses the correct composite primary key pattern with O.PrimaryKey on both meetingId and groupId.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/JoinMediaGroupReqMsgHdlr.scala (1)

50-52: No-op for existing participants prevents role updates via join.

When a participant already exists in the group, the handler returns the unchanged state. This means a user cannot change their sender/receiver flags by calling join again. Verify this is the intended behavior - if updates are needed, they should use MediaGroupUpdateParticipantReqMsg instead.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala (2)

15-15: LGTM - Clean migration from AudioGroups to MediaGroups.

The import, field instantiation, and state initialization are consistently updated to use the new MediaGroups infrastructure.

Also applies to: 142-142, 172-172


548-556: LGTM - Message routing correctly wired to mediaGroupHdlrs.

All eight MediaGroup message types are properly routed through the mediaGroupHdlrs.handle method, following the established pattern for other handler groups in the actor.

bbb-graphql-server/metadata/actions.graphql (1)

763-768: LGTM - MediaGroupParticipant input type is well-defined.

The input type correctly captures all required participant attributes: userId, sender, receiver, and active.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala (1)

175-191: LGTM - Message routing correctly updated for MediaGroup messages.

All eight MediaGroup request message types are properly routed using routeGenericMsg, following the established patterns in this actor. The routing aligns with the message definitions in MediaGroupsMsgs.scala.

bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (2)

74-80: Verify GraphQL subscription data shape (likely data.user_mediaGroup, not MediaGroupStream[]).
Line 74-80 casts data directly to MediaGroupStream[], but the subscription selects user_mediaGroup { ... } (see queries.ts). If createUseSubscription returns the raw Apollo payload, this will silently break filtering.

Safer parsing
-  const groups = (data as MediaGroupStream[] || []).filter(
+  const streams = ((data as any)?.user_mediaGroup ?? data ?? []) as MediaGroupStream[];
+  const groups = streams.filter(
     (group) => group.mediaType === mediaType,
   );

89-100: Hardcoded groupId: 'default' needs to match backend “public space” identifier.
If the backend uses a different sentinel (e.g., 'public', 'MAIN', etc.), clients may incorrectly treat real grouped users as “groupless” (or vice-versa).

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala (1)

4-10: No action needed. The trailing comma in the parameter list is valid Scala syntax. Trailing commas were introduced in Scala 2.12.2 (via SIP-27) and this project uses Scala 2.13.18, which fully supports them. The code compiles without issues.

Likely an incorrect or invalid review comment.

Comment thread bbb-graphql-server/bbb_schema.sql Resolved
@prlanzarin
prlanzarin marked this pull request as draft January 9, 2026 15:08
@github-actions

github-actions Bot commented Jan 9, 2026

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@prlanzarin prlanzarin added this to the Release 3.0 milestone Jan 9, 2026
@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

Real-time media components currently rely on participant "meshing," where
all participants see and hear each other. This prevents use cases requiring
asymmetric media relationships, such as proctoring, huddles, or embedded
breakout rooms. While audio groups exist for audio asymmetry, cameras and
screen sharing lack a similar mechanism.

Extend the audio groups mechanism to support cameras and RTC content,
renaming the feature to "MediaGroups." A MediaGroup is a logical unit
defined by an identifier, creator ID, media type, lock status, and lists
of broadcasters and viewers.

Groups have the following business logic:
- Broadcasters' streams are only visible to viewers of that group.
- Viewers filter visible streams to show only group broadcasters.
- Users can participate in multiple groups simultaneously in any capacity.
- Absence of a group assignment defaults to the "public" space.
- Locked groups are restricted to moderator manipulation.

Expose these actions to clients via GraphQL mutations. The `recorded`
attribute is included in the MediaGroup structure for future use, though
its functionality is not yet implemented.
Virtual public groups are not sufficient when  participants must hear/see
an union of users who are in public (i.e.: no groups) and ones that are
in specific media groups. This is by definition, since treating public
groups as the "absence of groups" makes things mutually exclusive here.

Add explicit, reserved public groups for the basic media types: audio,
camera and screenshare. All of them have static IDs
`public:${mediaType}`, and _cannot_ be destroyed nor altered in their
base structure by any user.

Users are automatically added to them at join time, and they can join/leave
those groups in any direction at any time during the meeting.

For the sake of conformity, selective subscription implementations MUST
still treat the absence of groups for an user a them being in the public
group. This preserves the previous virtual public group logic while
allowing for greater flexibility.
Enforce public media group states server-side for users on relevant
triggers (group creation, destruction, user join/leave/update).

This makes it easier to prevent users from being group-orphaned. Rather
than having media group consumers do this, the server guarantees a clean
state once users aren't part of specific media groups anymore.
@prlanzarin
prlanzarin force-pushed the u30/feat/media-groups branch from 46fc174 to 38cf995 Compare March 10, 2026 18:41
@prlanzarin
prlanzarin marked this pull request as ready for review March 10, 2026 18:41

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (13)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1)

50-52: Note: isValidSource will need extension for camera/screenshare support.

The current implementation correctly restricts to audio sources (Microphone, ScreenShareAudio). When extending to camera/screenshare, this function should become media-type-aware or be replaced with per-media-type source validation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts`
around lines 50 - 52, isValidSource currently only allows audio sources
(Track.Source.Microphone, Track.Source.ScreenShareAudio); update it to be
media-type-aware so it can validate camera/screenshare video sources when
needed. Replace or overload isValidSource to accept an additional mediaType
parameter (e.g., "audio" | "video") or create separate validators like
isValidAudioSource and isValidVideoSource, and adjust callers to pass the media
type or call the appropriate validator; ensure the new logic checks
Track.Source.Camera and Track.Source.ScreenShare (or equivalent video sources)
for video and keeps existing checks for audio.
bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts (2)

20-22: Use TypeError for type-related validation.

When validating that a value is of the expected type, TypeError is more semantically correct than a generic Error. This aligns with JavaScript conventions and the static analysis hint.

Suggested fix
   if (!Array.isArray(entries)) {
-    throw new Error('entries must be an array');
+    throw new TypeError('entries must be an array');
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts` around lines 20 -
22, Replace the generic Error thrown for the entries type check with a
TypeError: locate the Array.isArray(entries) guard in mediaGroupSetUserState
(the entries parameter check) and change throw new Error('entries must be an
array') to throw new TypeError('entries must be an array') so the validation
uses the semantically correct error class for type-related validation.

24-32: Unused index parameter; consider using it in error context.

The index variable is captured but unused. Either remove it to clean up the code, or leverage it to provide better error messages indicating which entry failed validation.

Option 1: Remove unused parameter
-  entries.forEach((entry, index) => {
+  entries.forEach((entry) => {
     throwErrorIfInvalidInput(entry, [
Option 2: Use index in error context (requires wrapping validation)
-  entries.forEach((entry, index) => {
-    throwErrorIfInvalidInput(entry, [
-      { name: 'groupId', type: 'string', required: true },
-      { name: 'mediaType', type: 'string', required: true },
-      { name: 'sender', type: 'boolean', required: true },
-      { name: 'receiver', type: 'boolean', required: true },
-      { name: 'active', type: 'boolean', required: true },
-    ]);
-  });
+  entries.forEach((entry, index) => {
+    try {
+      throwErrorIfInvalidInput(entry, [
+        { name: 'groupId', type: 'string', required: true },
+        { name: 'mediaType', type: 'string', required: true },
+        { name: 'sender', type: 'boolean', required: true },
+        { name: 'receiver', type: 'boolean', required: true },
+        { name: 'active', type: 'boolean', required: true },
+      ]);
+    } catch (error) {
+      throw new Error(`entries[${index}]: ${(error as Error).message}`);
+    }
+  });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts` around lines 24 -
32, The forEach callback currently captures an unused index; either remove the
index parameter to clean up the entries.forEach((entry) => ...) call, or modify
the validation call to include the index for better error context by changing
entries.forEach((entry, index) => { throwErrorIfInvalidInput(entry, [...], {
index }); }) or wrapping throwErrorIfInvalidInput in a try/catch inside
entries.forEach and rethrowing an error that includes the index (refer to
entries.forEach and throwErrorIfInvalidInput to locate the change).
bbb-graphql-actions/src/actions/mediaGroupCreate.ts (2)

4-4: Use a Set for PUBLIC_GROUP_IDS for cleaner membership checks.

A Set provides O(1) lookup and clearer semantics for membership testing.

♻️ Suggested refactor
-const PUBLIC_GROUP_IDS = ['public:audio', 'public:camera', 'public:screenshare'];
+const PUBLIC_GROUP_IDS = new Set(['public:audio', 'public:camera', 'public:screenshare']);

Then update line 28:

-  if (PUBLIC_GROUP_IDS.includes(groupId) || groupId.startsWith('public:')) {
+  if (PUBLIC_GROUP_IDS.has(groupId) || groupId.startsWith('public:')) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-actions/src/actions/mediaGroupCreate.ts` at line 4, Replace the
array PUBLIC_GROUP_IDS with a Set by changing its declaration to use new
Set(['public:audio','public:camera','public:screenshare']) and update any
membership checks that reference PUBLIC_GROUP_IDS (e.g., the check currently
using PUBLIC_GROUP_IDS.includes(...) in mediaGroupCreate logic) to use
PUBLIC_GROUP_IDS.has(value); also ensure any code that iterates the constant
adapts to Set iteration (Array.from(PUBLIC_GROUP_IDS) if an array is needed).

23-24: Prefer for...of loops for validation side effects.

Static analysis flags these forEach callbacks. Since validation is purely for side effects (throwing on invalid input), for...of is cleaner and avoids the lint warning.

♻️ Suggested refactor
-  senders?.forEach(sender => throwErrorIfInvalidInput(sender, participantValidator));
-  receivers?.forEach(receiver => throwErrorIfInvalidInput(receiver, participantValidator));
+  for (const sender of senders ?? []) {
+    throwErrorIfInvalidInput(sender, participantValidator);
+  }
+  for (const receiver of receivers ?? []) {
+    throwErrorIfInvalidInput(receiver, participantValidator);
+  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-actions/src/actions/mediaGroupCreate.ts` around lines 23 - 24,
The current use of Array.prototype.forEach with senders and receivers causes
static-analysis/lint warnings because the callbacks only perform side-effect
validation; replace both senders?.forEach(...) and receivers?.forEach(...) with
explicit for...of loops that iterate over senders and receivers and call
throwErrorIfInvalidInput(item, participantValidator) so that validation side
effects are preserved without the forEach lint issue; keep the optional chaining
(if needed) or guard with if (senders) / if (receivers) before the loops and
reuse the same participantValidator reference.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala (1)

70-83: Consider extracting the group from updatedGroups for broadcasting.

When an existing group is found and updated, handleMediaGroupUpdated is called with mg.id and updatedGroups. This works if handleMediaGroupUpdated re-fetches the group from updatedGroups. However, for clarity and consistency, consider extracting the updated group explicitly.

♻️ Optional refactor for clarity
       MediaGroupApp.findMediaGroup(groupId, state.mediaGroups) match {
         case Some(mg) =>
           // Just update the media group with the new participants
           val updatedGroups = MediaGroupApp.addMediaGroupParticipants(
             msg.body.id,
             senders,
             receivers,
             state.mediaGroups
           )
 
           insertParticipants(senders, receivers, mg.id)
           val newState = state.update(updatedGroups)
-          MediaGroupApp.handleMediaGroupUpdated(mg.id, updatedGroups, liveMeeting, bus.outGW)
+          MediaGroupApp.findMediaGroup(mg.id, updatedGroups).foreach { updatedMg =>
+            MediaGroupApp.handleMediaGroupUpdated(updatedMg.id, updatedGroups, liveMeeting, bus.outGW)
+          }
           newState
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala`
around lines 70 - 83, The handler updates an existing media group via
MediaGroupApp.addMediaGroupParticipants but then calls
MediaGroupApp.handleMediaGroupUpdated with the original mg.id and the whole
updatedGroups map; extract the updated group instance from updatedGroups (e.g.,
val updatedMg = updatedGroups(mg.id) or lookup by mg.id) and pass that explicit
updated group (instead of relying on handleMediaGroupUpdated to re-fetch) to
MediaGroupApp.handleMediaGroupUpdated along with updatedGroups, and use
updatedMg where appropriate for insertParticipants or subsequent logic to ensure
clarity and consistency.
bbb-graphql-server/bbb_schema.sql (1)

2514-2514: Consider explicit column selection instead of SELECT *.

Static analysis flagged this as a maintenance concern. Explicit columns make the view more resilient to schema changes.

♻️ Suggested fix
-CREATE VIEW "v_mediaGroup" AS SELECT * FROM "mediaGroup";
+CREATE VIEW "v_mediaGroup" AS SELECT "meetingId", "groupId", "mediaType", "locked", "record", "createdBy" FROM "mediaGroup";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-server/bbb_schema.sql` at line 2514, The view v_mediaGroup
currently uses SELECT * from mediaGroup which makes it fragile to schema
changes; replace the wildcard with an explicit, ordered list of columns from the
mediaGroup table (e.g., id, name, created_at, updated_at — use the actual column
names in your schema) when defining CREATE VIEW "v_mediaGroup" AS SELECT ...
FROM "mediaGroup"; to ensure the view remains stable and predictable when
columns are added/removed.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala (1)

3-3: Unused import.

RandomStringGenerator is imported but not used in this file.

🧹 Suggested fix
 package org.bigbluebutton.core.models
 import org.bigbluebutton.common2.msgs.{ MediaGroupParticipant }
-import org.bigbluebutton.core.util.RandomStringGenerator
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala`
at line 3, Remove the unused import of RandomStringGenerator: locate the import
statement "import org.bigbluebutton.core.util.RandomStringGenerator" in
MediaGroups.scala and delete it so the file no longer imports
RandomStringGenerator (no other changes needed).
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala (1)

54-54: Complete or remove the TODO comment.

The TODO indicates missing functionality for DB persistence of participants. If this is intentional for this PR, consider creating a tracking issue.

Would you like me to help implement the DB update for participants, or should I open an issue to track this task?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala`
at line 54, The TODO in MediaGroupAddParticipantsReqMsgHdlr.scala indicates
missing DB persistence for participants; either implement the persistence or
remove the TODO and create a tracking issue. To implement: locate the handler
method in class MediaGroupAddParticipantsReqMsgHdlr (e.g.,
handleMediaGroupAddParticipants or similar), call the media-group repository/DAO
(mediaGroupRepository or mediaGroupDao) to persist added participants (e.g.,
updateParticipants(mediaGroupId, participants)), wrap the call in the existing
execution context/transaction pattern, handle and log errors (processLogger or
logger.error) and add a unit/integration test that verifies DB state after the
handler runs. If you don’t want to implement now, remove the TODO and add a
clear tracked issue ID in the comment (e.g., TODO: persist participants -
ISSUE-1234) so work is tracked.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala (1)

15-16: Consider visibility of SENDERS constant.

The SENDERS constant is marked protected, which limits access to subclasses only. If other classes need to read this key (e.g., for deserialization or testing), consider making it package-private or public. If this follows the existing pattern for other record events in the codebase, it's fine as-is.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala`
around lines 15 - 16, The SENDERS constant in MediaGroupCreatedRecordEvent is
declared protected which restricts access to subclasses; change its visibility
to match other record event keys (make it public or package-private) so external
code (deserializers/tests) can access it—update the declaration of SENDERS in
object MediaGroupCreatedRecordEvent to use the same modifier used by other event
objects (e.g., remove protected or use private[<package>] or val SENDERS =
"senders") to restore appropriate visibility.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/SetUserMediaGroupStateReqMsgHdlr.scala (1)

30-44: Minor duplication in permission check logic.

The permissionFailed call with the same parameters appears both in the user-level check (lines 20-22) and the per-entry locked group check (lines 36-38). This is functionally correct but could be slightly cleaner by caching the moderator status.

♻️ Optional: Cache moderator status
+    val isRequesterModerator = !permissionFailed(
+      PermissionCheck.MOD_LEVEL,
+      PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, requesterId
+    )
+
     // Non-moderators can only set their own state
-    if (affectsOtherUser && permissionFailed(
-      PermissionCheck.MOD_LEVEL,
-      PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, requesterId
-    )) {
+    if (affectsOtherUser && !isRequesterModerator) {
       // ... existing ejection logic
     }

     // Per-entry permission check for locked groups
     val (permittedEntries, lockedErrors) = msg.body.entries.foldLeft(
       (Vector.empty[MediaGroupEntry], Vector.empty[MediaGroupEntryError])
     ) {
         case ((permitted, errors), entry) =>
           MediaGroupApp.findMediaGroup(entry.groupId, state.mediaGroups) match {
-            case Some(mg) if mg.locked && permissionFailed(
-              PermissionCheck.MOD_LEVEL,
-              PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, requesterId
-            ) =>
+            case Some(mg) if mg.locked && !isRequesterModerator =>
               (permitted, errors :+ MediaGroupEntryError(entry.groupId, entry.mediaType, "locked group requires moderator"))
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/SetUserMediaGroupStateReqMsgHdlr.scala`
around lines 30 - 44, The duplicate permission check can be simplified by
caching the requester’s moderator status once and reusing it: compute a boolean
like isModerator = !permissionFailed(PermissionCheck.MOD_LEVEL,
PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, requesterId) before iterating
entries, then replace the two permissionFailed(...) calls with checks against
isModerator (e.g., if mg.locked && !isModerator) in the per-entry fold and the
earlier user-level guard; reference the existing permissionFailed function and
MediaGroupApp.findMediaGroup/MediaGroupEntry handling when making the change.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (2)

31-44: Consider using a case class or builder for createMediaGroup parameters.

SonarCloud flags this function for having 8 parameters (limit is 7). While this is a minor issue, a MediaGroupCreateParams case class could improve readability and make the API more maintainable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`
around lines 31 - 44, The createMediaGroup function currently has 8 parameters;
extract them into a single parameter object (e.g., a MediaGroupCreateParams case
class) containing id, createdBy, mediaType, locked, record, senders, receivers
and optionally mediaGroups, then update createMediaGroup to accept that case
class (or provide an overloaded apply/create that accepts it) and construct the
MediaGroup using params.senders.toSet and params.receivers.toSet; update all
callers of createMediaGroup to build and pass MediaGroupCreateParams (or keep a
thin forwarding overload for backward compatibility) and ensure names like
createMediaGroup, MediaGroup and MediaGroupCreateParams are used to locate the
changes.

242-379: High cognitive complexity but acceptable given domain requirements.

SonarCloud flags this method for cognitive complexity (17 vs 15 allowed). The complexity stems from the legitimate need to handle three different scopes ("all", "byMediaType", "merge") with distinct semantics for additions, updates, and removals.

The function is well-structured with clear separation of concerns:

  1. Deduplication and validation (lines 251-261)
  2. Delta computation per scope (lines 278-315)
  3. Application of changes (lines 320-338)
  4. Public group re-enrollment (lines 344-361)

If refactoring is desired, consider extracting the scope-specific delta computation into separate private methods.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`
around lines 242 - 379, SonarCloud flags setUserMediaGroupState for high
cognitive complexity due to the large match block computing (toAdd, toUpdate,
toRemove); extract each scope branch into its own private helper to simplify the
main method. Create private methods (e.g., computeDeltaAll(desiredGroupMap,
currentGroupMap), computeDeltaByMediaType(desiredGroupMap, currentGroupMap,
valid), computeDeltaMerge(desiredGroupMap, currentGroupMap)) that return the
tuple (toAdd, toUpdate, toRemove) with the exact logic currently in the "all",
"byMediaType", and default/"merge" cases, then replace the match in
setUserMediaGroupState with calls to these helpers so behavior and returned
values remain identical. Ensure the helpers reference the same types
(Map[String, MediaGroupEntry]) and preserve the filtering logic for additions,
updates, and removals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`:
- Around line 181-188: The fold over PublicMediaGroupIds.All builds newMgState
but incorrectly queries the original mediaGroups each iteration; change the
lookup to use the accumulated state (acc) inside the fold so earlier enrollments
are visible—i.e., in the PublicMediaGroupIds.All.foldLeft(mediaGroups) block
replace mediaGroups.find(groupId) with acc.find(groupId) so
addMediaGroupParticipant, isUserSending/isUserReceiving checks, userId and
participant logic operate on the updated state.

In `@bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts`:
- Around line 36-39: The routing object is created from
sessionVariables['x-hasura-meetingid'] and sessionVariables['x-hasura-userid']
without validation; add an explicit check immediately before constructing
routing/header to ensure both values are present and non-empty, and throw a
descriptive error if not (reuse the existing throwErrorIfNotModerator helper or
add a new utility like throwErrorIfMissingSessionVar), so functions like
mediaGroupSetUserState that build routing and publish to Redis never proceed
with undefined meetingId/userId.

---

Nitpick comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala`:
- Around line 70-83: The handler updates an existing media group via
MediaGroupApp.addMediaGroupParticipants but then calls
MediaGroupApp.handleMediaGroupUpdated with the original mg.id and the whole
updatedGroups map; extract the updated group instance from updatedGroups (e.g.,
val updatedMg = updatedGroups(mg.id) or lookup by mg.id) and pass that explicit
updated group (instead of relying on handleMediaGroupUpdated to re-fetch) to
MediaGroupApp.handleMediaGroupUpdated along with updatedGroups, and use
updatedMg where appropriate for insertParticipants or subsequent logic to ensure
clarity and consistency.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala`:
- Line 54: The TODO in MediaGroupAddParticipantsReqMsgHdlr.scala indicates
missing DB persistence for participants; either implement the persistence or
remove the TODO and create a tracking issue. To implement: locate the handler
method in class MediaGroupAddParticipantsReqMsgHdlr (e.g.,
handleMediaGroupAddParticipants or similar), call the media-group repository/DAO
(mediaGroupRepository or mediaGroupDao) to persist added participants (e.g.,
updateParticipants(mediaGroupId, participants)), wrap the call in the existing
execution context/transaction pattern, handle and log errors (processLogger or
logger.error) and add a unit/integration test that verifies DB state after the
handler runs. If you don’t want to implement now, remove the TODO and add a
clear tracked issue ID in the comment (e.g., TODO: persist participants -
ISSUE-1234) so work is tracked.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`:
- Around line 31-44: The createMediaGroup function currently has 8 parameters;
extract them into a single parameter object (e.g., a MediaGroupCreateParams case
class) containing id, createdBy, mediaType, locked, record, senders, receivers
and optionally mediaGroups, then update createMediaGroup to accept that case
class (or provide an overloaded apply/create that accepts it) and construct the
MediaGroup using params.senders.toSet and params.receivers.toSet; update all
callers of createMediaGroup to build and pass MediaGroupCreateParams (or keep a
thin forwarding overload for backward compatibility) and ensure names like
createMediaGroup, MediaGroup and MediaGroupCreateParams are used to locate the
changes.
- Around line 242-379: SonarCloud flags setUserMediaGroupState for high
cognitive complexity due to the large match block computing (toAdd, toUpdate,
toRemove); extract each scope branch into its own private helper to simplify the
main method. Create private methods (e.g., computeDeltaAll(desiredGroupMap,
currentGroupMap), computeDeltaByMediaType(desiredGroupMap, currentGroupMap,
valid), computeDeltaMerge(desiredGroupMap, currentGroupMap)) that return the
tuple (toAdd, toUpdate, toRemove) with the exact logic currently in the "all",
"byMediaType", and default/"merge" cases, then replace the match in
setUserMediaGroupState with calls to these helpers so behavior and returned
values remain identical. Ensure the helpers reference the same types
(Map[String, MediaGroupEntry]) and preserve the filtering logic for additions,
updates, and removals.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/SetUserMediaGroupStateReqMsgHdlr.scala`:
- Around line 30-44: The duplicate permission check can be simplified by caching
the requester’s moderator status once and reusing it: compute a boolean like
isModerator = !permissionFailed(PermissionCheck.MOD_LEVEL,
PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, requesterId) before iterating
entries, then replace the two permissionFailed(...) calls with checks against
isModerator (e.g., if mg.locked && !isModerator) in the per-entry fold and the
earlier user-level guard; reference the existing permissionFailed function and
MediaGroupApp.findMediaGroup/MediaGroupEntry handling when making the change.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala`:
- Line 3: Remove the unused import of RandomStringGenerator: locate the import
statement "import org.bigbluebutton.core.util.RandomStringGenerator" in
MediaGroups.scala and delete it so the file no longer imports
RandomStringGenerator (no other changes needed).

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala`:
- Around line 15-16: The SENDERS constant in MediaGroupCreatedRecordEvent is
declared protected which restricts access to subclasses; change its visibility
to match other record event keys (make it public or package-private) so external
code (deserializers/tests) can access it—update the declaration of SENDERS in
object MediaGroupCreatedRecordEvent to use the same modifier used by other event
objects (e.g., remove protected or use private[<package>] or val SENDERS =
"senders") to restore appropriate visibility.

In `@bbb-graphql-actions/src/actions/mediaGroupCreate.ts`:
- Line 4: Replace the array PUBLIC_GROUP_IDS with a Set by changing its
declaration to use new
Set(['public:audio','public:camera','public:screenshare']) and update any
membership checks that reference PUBLIC_GROUP_IDS (e.g., the check currently
using PUBLIC_GROUP_IDS.includes(...) in mediaGroupCreate logic) to use
PUBLIC_GROUP_IDS.has(value); also ensure any code that iterates the constant
adapts to Set iteration (Array.from(PUBLIC_GROUP_IDS) if an array is needed).
- Around line 23-24: The current use of Array.prototype.forEach with senders and
receivers causes static-analysis/lint warnings because the callbacks only
perform side-effect validation; replace both senders?.forEach(...) and
receivers?.forEach(...) with explicit for...of loops that iterate over senders
and receivers and call throwErrorIfInvalidInput(item, participantValidator) so
that validation side effects are preserved without the forEach lint issue; keep
the optional chaining (if needed) or guard with if (senders) / if (receivers)
before the loops and reuse the same participantValidator reference.

In `@bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts`:
- Around line 20-22: Replace the generic Error thrown for the entries type check
with a TypeError: locate the Array.isArray(entries) guard in
mediaGroupSetUserState (the entries parameter check) and change throw new
Error('entries must be an array') to throw new TypeError('entries must be an
array') so the validation uses the semantically correct error class for
type-related validation.
- Around line 24-32: The forEach callback currently captures an unused index;
either remove the index parameter to clean up the entries.forEach((entry) =>
...) call, or modify the validation call to include the index for better error
context by changing entries.forEach((entry, index) => {
throwErrorIfInvalidInput(entry, [...], { index }); }) or wrapping
throwErrorIfInvalidInput in a try/catch inside entries.forEach and rethrowing an
error that includes the index (refer to entries.forEach and
throwErrorIfInvalidInput to locate the change).

In `@bbb-graphql-server/bbb_schema.sql`:
- Line 2514: The view v_mediaGroup currently uses SELECT * from mediaGroup which
makes it fragile to schema changes; replace the wildcard with an explicit,
ordered list of columns from the mediaGroup table (e.g., id, name, created_at,
updated_at — use the actual column names in your schema) when defining CREATE
VIEW "v_mediaGroup" AS SELECT ... FROM "mediaGroup"; to ensure the view remains
stable and predictable when columns are added/removed.

In
`@bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts`:
- Around line 50-52: isValidSource currently only allows audio sources
(Track.Source.Microphone, Track.Source.ScreenShareAudio); update it to be
media-type-aware so it can validate camera/screenshare video sources when
needed. Replace or overload isValidSource to accept an additional mediaType
parameter (e.g., "audio" | "video") or create separate validators like
isValidAudioSource and isValidVideoSource, and adjust callers to pass the media
type or call the appropriate validator; ensure the new logic checks
Track.Source.Camera and Track.Source.ScreenShare (or equivalent video sources)
for video and keeps existing checks for audio.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7554f208-31bd-4d93-ae50-29090222135a

📥 Commits

Reviewing files that changed from the base of the PR and between 46fc174 and 38cf995.

📒 Files selected for processing (53)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupRemoveParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupUpdateParticipantReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/CreateAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/DestroyAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/GetAudioGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/JoinAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/LeaveAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/CreateMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupAddParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/SetUserMediaGroupStateReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserJoinMeetingReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/AudioGroupDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MediaGroupUserDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/domain/MeetingState2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/AudioGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractAudioGroupRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractMediaGroupRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/AudioGroupsMsgs.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala
  • bbb-graphql-actions/src/actions/audioGroupCreate.ts
  • bbb-graphql-actions/src/actions/audioGroupJoin.ts
  • bbb-graphql-actions/src/actions/audioGroupUpdateParticipant.ts
  • bbb-graphql-actions/src/actions/mediaGroupCreate.ts
  • bbb-graphql-actions/src/actions/mediaGroupDestroy.ts
  • bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts
  • bbb-graphql-server/bbb_schema.sql
  • bbb-graphql-server/metadata/actions.graphql
  • bbb-graphql-server/metadata/actions.yaml
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_mediaGroup.yaml
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_mediaGroup.yaml
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/tables.yaml
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/component.tsx
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/queries.ts
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/types.ts
💤 Files with no reviewable changes (19)
  • bbb-graphql-actions/src/actions/audioGroupUpdateParticipant.ts
  • bbb-graphql-actions/src/actions/audioGroupCreate.ts
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractAudioGroupRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupCreatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupUpdateParticipantReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/JoinAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/CreateAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/AudioGroupDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/LeaveAudioGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupRemoveParticipantsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupUpdatedRecordEvent.scala
  • bbb-graphql-actions/src/actions/audioGroupJoin.ts
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/AudioGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/AudioGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AudioGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/GetAudioGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/audiogroups/DestroyAudioGroupReqMsgHdlr.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/AudioGroupsMsgs.scala
🚧 Files skipped from review as they are similar to previous changes (6)
  • bbb-graphql-actions/src/actions/mediaGroupDestroy.ts
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupDestroyedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/GetMediaGroupsReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/MediaGroupUpdatedRecordEvent.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/record/events/AbstractMediaGroupRecordEvent.scala

@bigbluebutton bigbluebutton deleted a comment from sonarqubecloud Bot Mar 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (1)

279-315: ⚠️ Potential issue | 🟠 Major

Zero-role entries should become removals, not stored rows.

For "all" / "byMediaType", an entry with sender=false and receiver=false can still land in toAdd/toUpdate. The in-memory model drops the user from the role sets, but the DAO call still writes a user_mediaGroup row with no role bits set. That leaves garbage rows behind and makes the next real join hit an insert/update mismatch on the same PK.

Normalize replacement scopes around “has at least one role”
+    def hasRole(entry: MediaGroupEntry): Boolean = entry.sender || entry.receiver
+
     val (toAdd, toUpdate, toRemove) = scope match {
       case "all" =>
         // all = replace the user's entire state
-        val additions = desiredGroupMap.filter { case (gid, _) => !currentGroupMap.contains(gid) }
+        val additions = desiredGroupMap.filter { case (gid, entry) =>
+          hasRole(entry) && !currentGroupMap.contains(gid)
+        }
         val updates = desiredGroupMap.filter { case (gid, entry) =>
-          currentGroupMap.get(gid).exists(cur =>
+          hasRole(entry) && currentGroupMap.get(gid).exists(cur =>
             cur.sender != entry.sender || cur.receiver != entry.receiver || cur.active != entry.active)
         }
-        val removals = currentGroupMap.filter { case (gid, _) => !desiredGroupMap.contains(gid) }
+        val removals = currentGroupMap.filter { case (gid, _) =>
+          !desiredGroupMap.get(gid).exists(hasRole)
+        }

Apply the same hasRole guard in the "byMediaType" branch as well.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`
around lines 279 - 315, The replacement branches ("all" and "byMediaType") must
treat entries with no roles (sender==false && receiver==false) as removals
instead of adds/updates: when computing additions and updates from
desiredGroupMap (and in byMediaType when computing against scopedCurrentMap),
filter desired entries by hasRole = (e.sender || e.receiver) so only entries
with at least one role are considered for adds/updates; conversely, consider
desired entries with !hasRole as removals if currentGroupMap (or
scopedCurrentMap) contains that gid and include them in removals. Update the
logic that computes additions, updates, and removals (referencing
desiredGroupMap, currentGroupMap, scopedCurrentMap, additions, updates,
removals) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`:
- Around line 254-262: Validation currently drops invalid entries (computed by
the deduped.foldLeft producing valid and errors), and desiredGroupMap is built
only from valid which can cause removal of existing memberships for errored
groupIds; instead, when an entry produced an error (errors Vector contains
MediaGroupEntryError for a groupId) insert the current membership (lookup via
mediaGroups.find(groupId)) into desiredGroupMap (or otherwise preserve the
existing entry) so that groups with validation errors are treated as no-op and
not removed; modify the code around deduped.foldLeft / desiredGroupMap to merge
valid entries with existing mediaGroups for errored groupIds (use
MediaGroupEntryError.groupId and mediaGroups.find) so replacement scopes do not
partially apply.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala`:
- Around line 561-565: The media-group message handlers in MeetingActor (cases
for CreateMediaGroupReqMsg, DestroyMediaGroupReqMsg, GetMediaGroupsReqMsg,
SetUserMediaGroupStateReqMsg) mutate meeting state but do not update user
activity; call updateUserLastActivity(...) for the acting user after
mediaGroupHdlrs.handle(...) returns (same pattern used by neighboring write
paths) so moderator actions refresh last-activity timestamp; ensure you pass the
correct userId from the incoming message context and update the state with the
result of updateUserLastActivity(state, userId) before continuing.

In `@akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala`:
- Around line 97-105: AnalyticsActor is missing handling for
MediaGroupUpdatedEvtMsg so membership-change events aren't logged; add a case
for MediaGroupUpdatedEvtMsg in the actor's receive/switch alongside the other
media-group cases and call logMessage(msg) for it. Locate the pattern matching
block that contains cases like CreateMediaGroupReqMsg, MediaGroupCreatedEvtMsg,
DestroyMediaGroupReqMsg, etc., and insert a new case for MediaGroupUpdatedEvtMsg
=> logMessage(msg) so the actor emits the update events to analytics.

In `@bbb-graphql-server/bbb_schema.sql`:
- Around line 2503-2511: The mediaType column in the mediaGroup table is
currently unrestricted; add a DB-level constraint to reject any value other than
the supported set ('audio', 'camera', 'screenshare') so invalid writes cannot
create un-mappable groups. Update the CREATE TABLE for "mediaGroup" (or add an
ALTER TABLE) to add a CHECK (or ENUM) constraint on "mediaType" (e.g., a named
constraint like "mediaGroup_mediaType_check") that only allows 'audio',
'camera', and 'screenshare'. Ensure the constraint name references mediaGroup
and mediaType so it’s easy to locate and maintain.

---

Duplicate comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`:
- Around line 279-315: The replacement branches ("all" and "byMediaType") must
treat entries with no roles (sender==false && receiver==false) as removals
instead of adds/updates: when computing additions and updates from
desiredGroupMap (and in byMediaType when computing against scopedCurrentMap),
filter desired entries by hasRole = (e.sender || e.receiver) so only entries
with at least one role are considered for adds/updates; conversely, consider
desired entries with !hasRole as removals if currentGroupMap (or
scopedCurrentMap) contains that gid and include them in removals. Update the
logic that computes additions, updates, and removals (referencing
desiredGroupMap, currentGroupMap, scopedCurrentMap, additions, updates,
removals) accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4a5cc0d0-5321-4c05-957e-0a17da5af2df

📥 Commits

Reviewing files that changed from the base of the PR and between 38cf995 and b694a43.

📒 Files selected for processing (8)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala
  • bbb-graphql-server/bbb_schema.sql

Comment thread bbb-graphql-server/bbb_schema.sql Resolved
…tUserMediaGroupState

The media groups API uses three separate imperative operations (join,
leave, update) to change user media group membership. Multi-group state
transitions required chaining these operations sequentially, while
ordering cannot be reliably guaranteed by neither server or clients.
This creates race conditions where users can end up in inconsistent states
across audio, video and screen sharing groups.

Replace the join/leave/update media group APIs with a single declarative
setUserMediaGroupState API. The client declares their desired media
group state with a varying degree or specificity via the `scope`
parameter.

The scope parameter can be one of:
- "merge": entries merge with existing state. Groups not listed are
  untouched; sender=false + receiver=false = removal.
- "byMediaType": entries replace state per mediaType. Only media types
     present in entries are affected; others are untouched.
- "all": entries replace entire state. Groups not listed are removed.

Additionally:
  - fix: prevent duplicate sender/receiver references in MediaGroups model
  - fix: prevent enrolling users in the same public group multiple times unnecessarily
  - refactor: remove MediaGroupAddParticipants handlers
  - refactor: log media group update evt, count media groups towards user activity and bail out update on replacement scopes if any group fails
@prlanzarin
prlanzarin force-pushed the u30/feat/media-groups branch from b694a43 to dd4a274 Compare March 10, 2026 20:56
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
bbb-graphql-server/metadata/actions.yaml (1)

661-667: ⚠️ Potential issue | 🟠 Major

Register MediaGroupStateEntry in custom_types.input_objects.

The new mediaGroupSetUserState action accepts [MediaGroupStateEntry!]!, but this input object is not registered in the metadata. Add it alongside the existing custom input objects to keep the schema in sync.

Suggested fix
   input_objects:
     - name: BreakoutRoom
     - name: GuestUserApprovalStatus
     - name: MediaGroupParticipant
+    - name: MediaGroupStateEntry
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-server/metadata/actions.yaml` around lines 661 - 667, Add the
missing input object registration for MediaGroupStateEntry to
custom_types.input_objects so the schema matches the new action; locate the
custom_types.input_objects list (which already contains BreakoutRoom,
GuestUserApprovalStatus, MediaGroupParticipant) and add an entry for
MediaGroupStateEntry so the mediaGroupSetUserState action's parameter type
[MediaGroupStateEntry!]! is defined in the metadata.
♻️ Duplicate comments (2)
bbb-graphql-server/bbb_schema.sql (1)

2503-2512: ⚠️ Potential issue | 🟠 Major

Constrain mediaType at the database boundary.

The rest of this feature only understands audio, camera, and screenshare. Without a CHECK here, a bad write can persist groups that the public-group mapping and fallback logic cannot interpret.

Suggested fix
 CREATE UNLOGGED TABLE "mediaGroup" (
 	"meetingId" 			varchar(100),
 	"groupId"					varchar(100),
 	"mediaType"				varchar(50) NOT NULL,
 	"locked"					boolean NOT NULL DEFAULT false,
 	"record"					boolean NOT NULL DEFAULT false,
 	"createdBy"				varchar(50),
 	CONSTRAINT "mediaGroup_pkey" PRIMARY KEY ("meetingId", "groupId"),
+	CONSTRAINT "mediaGroup_mediaType_check"
+		CHECK ("mediaType" IN ('audio', 'camera', 'screenshare')),
 	FOREIGN KEY ("meetingId") REFERENCES "meeting"("meetingId") ON DELETE CASCADE
 );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-server/bbb_schema.sql` around lines 2503 - 2512, Add a
database-level CHECK limiting the "mediaType" column on the "mediaGroup" table
to only the allowed values used by the app ("audio", "camera", "screenshare");
update the CREATE UNLOGGED TABLE "mediaGroup" statement to include a CHECK
(mediaType IN (...)) or add a migration that ALTER TABLE "mediaGroup" ADD
CONSTRAINT "mediaGroup_mediaType_check" CHECK (mediaType IN (...)) so invalid
media types cannot be persisted and the public-group mapping/fallback logic will
always receive a known set of types.
bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts (1)

36-39: ⚠️ Potential issue | 🟠 Major

Fail fast when the Hasura session headers are missing.

routing and header are built from unchecked session values here. If either header is absent, this publishes a SetUserMediaGroupStateReqMsg with undefined routing fields instead of rejecting the request up front.

Suggested fix
+  const meetingId = sessionVariables['x-hasura-meetingid'];
+  const requesterId = sessionVariables['x-hasura-userid'];
+
+  if (typeof meetingId !== 'string' || !meetingId || typeof requesterId !== 'string' || !requesterId) {
+    throw new Error('Missing required session variables: x-hasura-meetingid, x-hasura-userid');
+  }
+
   const routing = {
-    meetingId: sessionVariables['x-hasura-meetingid'] as string,
-    userId: sessionVariables['x-hasura-userid'] as string
+    meetingId,
+    userId: requesterId,
   };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts` around lines 36 -
39, The code builds routing and header from
sessionVariables['x-hasura-meetingid'] and ['x-hasura-userid'] without checking
existence, which can cause publishing a SetUserMediaGroupStateReqMsg with
undefined fields; add an explicit guard before constructing routing/header:
validate both session headers are present and non-empty, and if either is
missing reject/throw (or return an HTTP/GraphQL error) immediately instead of
continuing, then only construct routing and call the publisher when both values
are valid. Use the exact keys 'x-hasura-meetingid' and 'x-hasura-userid' and the
existing symbols routing, header, and SetUserMediaGroupStateReqMsg to locate
where to insert the check.
🧹 Nitpick comments (2)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala (1)

48-52: Consider error handling for DAO operations.

The in-memory state is updated and the event is broadcast before the DAO deletions complete. If MediaGroupUserDAO.deleteAll or MediaGroupDAO.delete fails, the in-memory state and database will be inconsistent.

If the in-memory state is intentionally the source of truth (with DB as best-effort persistence), this is acceptable. Otherwise, consider wrapping in a try-catch or ensuring DAO operations are reliable.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala`
around lines 48 - 52, The code currently calls MediaGroupApp.deleteMediaGroup
and then broadcastEvent(mg) and state.update(updatedGroups) before performing
MediaGroupUserDAO.deleteAll and MediaGroupDAO.delete, risking DB/in-memory
inconsistency if the DAO calls fail; move the DAO deletions
(MediaGroupUserDAO.deleteAll and MediaGroupDAO.delete) to occur before
state.update(updatedGroups) and broadcastEvent(mg), and wrap the DAO calls in a
try-catch (or Future recovery) to log failures and avoid updating
state/broadcasting on error (or implement a compensating rollback path) so that
state.update and broadcastEvent are only executed after successful DAO deletion.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala (1)

242-390: Split validation, diffing, and side effects into helpers.

setUserMediaGroupState now owns request validation, scope diffing, DAO writes, public fallback enrollment, and event fan-out. Extracting those phases would reduce the current complexity and make future rule changes much safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`
around lines 242 - 390, The method setUserMediaGroupState is doing validation,
scope diffing, DAO writes, public-fallback enrollment, and event fan-out all
inline; extract these responsibilities into small helper functions to reduce
complexity: move request validation into a validateEntries(entries:
Vector[MediaGroupEntry], mediaGroups: MediaGroups): (Vector[MediaGroupEntry],
Vector[MediaGroupEntryError]) that returns valid and errors (use
MediaGroupEntryError), move scope diffing into computeDelta(scope: String,
valid: Vector[MediaGroupEntry], currentGroupMap: Map[String, MediaGroupEntry]):
(Map[String,MediaGroupEntry],Map[String,MediaGroupEntry],Map[String,MediaGroupEntry])
which produces toAdd/toUpdate/toRemove, move DAO side-effects into
applyDelta(meetingId: Int, userId: String, toAdd:..., toUpdate:...,
toRemove:..., mediaGroups: MediaGroups): (MediaGroups, Set[String]) that uses
MediaGroupUserDAO.insertUser/update/delete and
addMediaGroupParticipant/removeMediaGroupParticipant/updateMediaGroupParticipant,
and move public fallback enrollment into
ensurePublicEnrollment(updatedMediaGroups: MediaGroups, userId: String,
meetingId: Int): (MediaGroups, Set[String]) that uses
PublicMediaGroupIds.publicGroupIdForMediaType and MediaGroupUserDAO.insertUser;
finally call handleMediaGroupUpdated for affectedGroupIds. Keep behavior and
return types identical to preserve SetUserMediaGroupStateResult.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`:
- Around line 242-260: The validation currently only checks existence and
mediaType in setUserMediaGroupState; add a locked-group check so entries
targeting a MediaGroup with mg.locked == true are rejected here (since this
layer cannot distinguish moderator actions), by updating the fold in
setUserMediaGroupState to first check mediaGroups.find(entry.groupId) and if
found and mg.locked == true append a MediaGroupEntryError (e.g. "group locked")
to errors; otherwise proceed with the mediaType match as before (use the
existing MediaGroupEntryError shape and the symbols mediaGroups.find, mg.locked,
MediaGroupEntryError, and setUserMediaGroupState to locate and implement the
change).
- Around line 57-59: deleteMediaGroup currently allows removing system-managed
fallback groups; add a guard in deleteMediaGroup(id: String, mediaGroups:
MediaGroups) that checks id against a reserved set (e.g. "public:audio",
"public:camera", "public:screenshare") and if it matches, do not remove and
instead return the original mediaGroups (optionally log or raise an error).
Update the function to perform this membership check before calling
mediaGroups.remove so reserved IDs are never deleted.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala`:
- Around line 57-60: findParticipant and findAllParticipants currently return
duplicate MediaGroupParticipant entries when the same userId exists in both
senders and receivers; change both to materialize participants by merging
senders and receivers keyed by userId into a single MediaGroupParticipant per
userId (e.g., build a Map[userId, MediaGroupParticipant] by iterating senders
and receivers and combining/overwriting fields such as isSender/isReceiver or
stream info), then implement findParticipant to look up by userId in that merged
map and findAllParticipants to return the merged map.values.toVector; update the
logic that builds/merges the MediaGroupParticipant (in the same class) to
deterministically combine fields so one logical participant represents a user
present in both collections.

---

Outside diff comments:
In `@bbb-graphql-server/metadata/actions.yaml`:
- Around line 661-667: Add the missing input object registration for
MediaGroupStateEntry to custom_types.input_objects so the schema matches the new
action; locate the custom_types.input_objects list (which already contains
BreakoutRoom, GuestUserApprovalStatus, MediaGroupParticipant) and add an entry
for MediaGroupStateEntry so the mediaGroupSetUserState action's parameter type
[MediaGroupStateEntry!]! is defined in the metadata.

---

Duplicate comments:
In `@bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts`:
- Around line 36-39: The code builds routing and header from
sessionVariables['x-hasura-meetingid'] and ['x-hasura-userid'] without checking
existence, which can cause publishing a SetUserMediaGroupStateReqMsg with
undefined fields; add an explicit guard before constructing routing/header:
validate both session headers are present and non-empty, and if either is
missing reject/throw (or return an HTTP/GraphQL error) immediately instead of
continuing, then only construct routing and call the publisher when both values
are valid. Use the exact keys 'x-hasura-meetingid' and 'x-hasura-userid' and the
existing symbols routing, header, and SetUserMediaGroupStateReqMsg to locate
where to insert the check.

In `@bbb-graphql-server/bbb_schema.sql`:
- Around line 2503-2512: Add a database-level CHECK limiting the "mediaType"
column on the "mediaGroup" table to only the allowed values used by the app
("audio", "camera", "screenshare"); update the CREATE UNLOGGED TABLE
"mediaGroup" statement to include a CHECK (mediaType IN (...)) or add a
migration that ALTER TABLE "mediaGroup" ADD CONSTRAINT
"mediaGroup_mediaType_check" CHECK (mediaType IN (...)) so invalid media types
cannot be persisted and the public-group mapping/fallback logic will always
receive a known set of types.

---

Nitpick comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala`:
- Around line 48-52: The code currently calls MediaGroupApp.deleteMediaGroup and
then broadcastEvent(mg) and state.update(updatedGroups) before performing
MediaGroupUserDAO.deleteAll and MediaGroupDAO.delete, risking DB/in-memory
inconsistency if the DAO calls fail; move the DAO deletions
(MediaGroupUserDAO.deleteAll and MediaGroupDAO.delete) to occur before
state.update(updatedGroups) and broadcastEvent(mg), and wrap the DAO calls in a
try-catch (or Future recovery) to log failures and avoid updating
state/broadcasting on error (or implement a compensating rollback path) so that
state.update and broadcastEvent are only executed after successful DAO deletion.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala`:
- Around line 242-390: The method setUserMediaGroupState is doing validation,
scope diffing, DAO writes, public-fallback enrollment, and event fan-out all
inline; extract these responsibilities into small helper functions to reduce
complexity: move request validation into a validateEntries(entries:
Vector[MediaGroupEntry], mediaGroups: MediaGroups): (Vector[MediaGroupEntry],
Vector[MediaGroupEntryError]) that returns valid and errors (use
MediaGroupEntryError), move scope diffing into computeDelta(scope: String,
valid: Vector[MediaGroupEntry], currentGroupMap: Map[String, MediaGroupEntry]):
(Map[String,MediaGroupEntry],Map[String,MediaGroupEntry],Map[String,MediaGroupEntry])
which produces toAdd/toUpdate/toRemove, move DAO side-effects into
applyDelta(meetingId: Int, userId: String, toAdd:..., toUpdate:...,
toRemove:..., mediaGroups: MediaGroups): (MediaGroups, Set[String]) that uses
MediaGroupUserDAO.insertUser/update/delete and
addMediaGroupParticipant/removeMediaGroupParticipant/updateMediaGroupParticipant,
and move public fallback enrollment into
ensurePublicEnrollment(updatedMediaGroups: MediaGroups, userId: String,
meetingId: Int): (MediaGroups, Set[String]) that uses
PublicMediaGroupIds.publicGroupIdForMediaType and MediaGroupUserDAO.insertUser;
finally call handleMediaGroupUpdated for affectedGroupIds. Keep behavior and
return types identical to preserve SetUserMediaGroupStateResult.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d6538674-c2e3-44b8-9163-f8e4b0cab26f

📥 Commits

Reviewing files that changed from the base of the PR and between b694a43 and dd4a274.

📒 Files selected for processing (13)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/DestroyMediaGroupReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupApp.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/SetUserMediaGroupStateReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/MediaGroups.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/AnalyticsActor.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/MediaGroupsMsgs.scala
  • bbb-graphql-actions/src/actions/mediaGroupSetUserState.ts
  • bbb-graphql-server/bbb_schema.sql
  • bbb-graphql-server/metadata/actions.graphql
  • bbb-graphql-server/metadata/actions.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/SetUserMediaGroupStateReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/mediagroups/MediaGroupHdlrs.scala

@prlanzarin
prlanzarin changed the base branch from v3.0.x-release to v3.0.x-develop March 23, 2026 19:44
@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@prlanzarin
prlanzarin merged commit 4d7d7f9 into bigbluebutton:v3.0.x-develop Mar 23, 2026
59 checks passed
antobinary pushed a commit that referenced this pull request Apr 24, 2026
After PR #24427 introduced public media groups, LiveKit SIP
dial-in participants are inaudible to browser users. Two causes:
- Dial-in users bypass UserJoinMeetingReqMsgHdlr and so are
  never enrolled in public:audio, meaning the are ignored by selective
  subscription
- The client matches LK participants by identity (sip_<hash>
  for SIP) while media-group records use BBB intIds (v_<sid>).
  These coincide only for web users.

Make dial-in users audible again via:
- Enroll dial-in users in the public media groups via
  UserJoinedVoiceConfEvtMsgHdlr's letUserEnter
- Add intId-to-identity mapping in selective subscription's hooks,
  mirroring bbb-webrtc-sfu's strategy to properly add dial-in/voice only
  streams to the subscription pool.
antobinary added a commit that referenced this pull request Apr 24, 2026
* fix(livekit): dial-in unable to be heard by web users

After PR #24427 introduced public media groups, LiveKit SIP
dial-in participants are inaudible to browser users. Two causes:
- Dial-in users bypass UserJoinMeetingReqMsgHdlr and so are
  never enrolled in public:audio, meaning the are ignored by selective
  subscription
- The client matches LK participants by identity (sip_<hash>
  for SIP) while media-group records use BBB intIds (v_<sid>).
  These coincide only for web users.

Make dial-in users audible again via:
- Enroll dial-in users in the public media groups via
  UserJoinedVoiceConfEvtMsgHdlr's letUserEnter
- Add intId-to-identity mapping in selective subscription's hooks,
  mirroring bbb-webrtc-sfu's strategy to properly add dial-in/voice only
  streams to the subscription pool.

* refactor(livekit): index remoteParticipants by identity (selective sub)

Selective subscription's handleSubscriptionChanges does two participant
array lookups per iteration over subscription pools - while we already
iterate over the participants array earlier and could build a static map
beforehand. Not a big thing, but since these ops _may_ be bursty in
nature, there's no reason not to do this more efficiently.

Build a Map<identity, RemoteParticipant> during the existing initial
iteration and replace both lookups with a map lookup.

* fix(livekit): cover BBB intId in debounced mute fallback lookup

useWhoIsUnmutedLiveKit stores its state-var keyed by LK
participant.identity when LK is connected and by BBB intId when it
falls back to the graphql source on LK disconnect. For web users
those keys coincide; for SIP / voice-only participants (identity
sip_<hash>, intId v_<sid>) they don't.

Check both keys: LK identity first (connected steady state), BBB
intId via getBbbUserIdForParticipant as a fallback (disconnected
steady state).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant