Skip to content

feat: implement "Request to Become Presenter" feature for viewers - #24341

Merged
lfzawacki merged 4 commits into
bigbluebutton:v3.1.x-releasefrom
AtilaU19:task-753
Dec 16, 2025
Merged

lfzawacki merged 4 commits into
bigbluebutton:v3.1.x-releasefrom
AtilaU19:task-753

Conversation

@AtilaU19

@AtilaU19 AtilaU19 commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR implements a new feature that allows viewers to request the presenter role from moderators. Instead of just moderators manually assigning the presenter role, viewers can now proactively request it, and moderators receive a notification to approve or deny the request.

  • Add ability for viewers to request presenter role from moderators
  • Implement toast notification system for moderator approval workflow
  • Add requestedPresenter flag to user state in database
  • Support multiple simultaneous presenter requests via stacked notifications

Closes Issue(s)

Closes None

More

Screencast.from.08-12-2025.17.33.38.webm

- Add ability for viewers to request presenter role from moderators
- Implement toast notification system for moderator approval workflow
- Support multiple simultaneous presenter requests via stacked notifications
Copilot AI review requested due to automatic review settings December 8, 2025 21:21
@coderabbitai

coderabbitai Bot commented Dec 8, 2025 •

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a presenter-request feature end-to-end. Introduces a new client message type UserSetPresenterRequestReqMsg and a handler mixed into MeetingActor to process requests and approvals. Persists a new requestedPresenter: Boolean field in the user model and database. Exposes GraphQL mutation/subscription for requesting and observing presenter requests. Frontend UI components and styles add a "Request Presenter" action, moderator notifications for approve/deny, and mutation/subscription wiring to coordinate the flow.

Sequence Diagram

sequenceDiagram
    participant User as User (Non-Moderator)
    participant UI as Frontend UI
    participant GraphQL as GraphQL API
    participant Backend as MeetingActor
    participant DB as Database
    participant ModUI as Moderator UI

    User->>UI: Click "Request Presenter"
    UI->>GraphQL: Mutation userSetPresenterRequest(requestedPresenter: true)
    GraphQL->>Backend: UserSetPresenterRequestReqMsg(requestedPresenter: true)
    Backend->>DB: update requestedPresenter = true
    DB-->>Backend: ack
    Backend->>GraphQL: emit PRESENTER_REQUEST_SUBSCRIPTION update
    GraphQL->>ModUI: subscription update (user requested)

    ModUI->>UI: Approve or Deny action
    UI->>GraphQL: Mutation userSetPresenterRequest(requestedPresenter: false, userId, approved)
    GraphQL->>Backend: UserSetPresenterRequestReqMsg(requestedPresenter: false, approved)
    alt approved
        Backend->>Backend: assign presenter (handlePresenterChange)
        Backend->>DB: update requestedPresenter = false
        Backend->>GraphQL: broadcast presenter change
    else denied
        Backend->>DB: update requestedPresenter = false
        Backend->>GraphQL: broadcast denial
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • UserSetPresenterRequestReqMsgHdlr.scala — permission logic, approval path, presenter assignment flow
  • UserStateDAO.scala & Users2x.scala — DB mapping, migrations, and DAO updateRequestedPresenter correctness
  • MeetingActor.scala & ReceivedJsonMsgHandlerActor.scala — message routing and actor integration
  • GraphQL actions and Hasura metadata — mutation/handler/header correctness
  • Frontend: request-presenter components (container, component, mutations, subscriptions), MediaArea/MediaSharingModal prop wiring and notification behavior

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main feature: implementing a presenter request feature for viewers, which aligns with the substantial changes across the codebase.
Description check ✅ Passed The description comprehensively covers the PR objectives: viewers can request presenter, moderators receive notifications, requestedPresenter flag added to database, and support for multiple simultaneous requests.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 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: 2

🧹 Nitpick comments (10)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/subscriptions.ts (1)

1-13: Scope the subscription more explicitly to the current meeting

Right now the subscription selects all user rows where requestedPresenter = true without an explicit meeting or “currently in meeting” constraint. If row‑level permissions don’t already constrain this, moderators could see stale or cross‑meeting requests.

Consider adding an explicit meetingId (and optionally currentlyInMeeting) predicate and passing the current meetingId as a variable through useSubscription. Please also double‑check the Hasura permissions on this query to ensure it’s properly scoped.

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx (1)

33-42: Presenter/request flow wiring is correct; consider inverting the negated condition for clarity

The new flow looks sound:

  • Non‑presenters now always land in renderTakePresenterView, with:
    • Moderators → “Take presenter” button wired to handleTakePresenter
    • Viewers → “Request presenter” button wired to handleRequestPresenter
  • Distinct data-test IDs for take vs request buttons will help E2E tests.
  • New i18n keys for request presenter are consistent with the existing take‑presenter messages.

The !amIPresenter ? renderTakePresenterView() : … ternary is slightly harder to read and is what Sonar flags as an “unexpected negated condition”. You could improve readability (and satisfy the rule) by inverting it:

-        {!amIPresenter
-          ? renderTakePresenterView()
-          : (
+        {amIPresenter
+          ? (
             <>
               {/* existing presenter modal content */}
             </>
-          )}
+          )
+          : renderTakePresenterView()}

Functionally equivalent, but easier to scan.

Also applies to: 101-108, 135-151, 319-346, 376-404

bigbluebutton-html5/imports/ui/components/app/component.tsx (1)

53-53: RequestPresenterContainer is wired into the main app flow appropriately

Mounting <RequestPresenterContainer /> in the non‑PRESENTATION_ONLY branch integrates the new presenter‑request notifications into the main client without disturbing existing layout logic.

The absolute import path matches the style already used throughout this file; if Sonar keeps flagging it, consider relaxing that rule for this project rather than changing this single import.

Also applies to: 126-203

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx (1)

17-18: Mutation‑based request‑presenter handler is correctly implemented

handleRequestPresenter uses the shared USER_SET_PRESENTER_REQUEST mutation to set requestedPresenter: true for the current user, while moderators still use SET_PRESENTER via handleTakePresenter. Passing handleRequestPresenter through to MediaArea/MediaSharingModal cleanly separates the viewer vs moderator flows without over‑exposing userId on the client.

The absolute import for the mutation matches existing patterns in this module; if Sonar enforces a different convention, it’s better handled via rule configuration than by special‑casing this one line.

Also applies to: 50-52, 57-64, 68-87

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (1)

15-33: MediaArea now renders for non-presenters; ensure modal still enforces capabilities

Passing handleRequestPresenter down and relaxing the guard to only isMeteorConnected makes sense for enabling viewer-initiated presenter requests. Just ensure:

  • handleRequestPresenter is typed consistently between MediaAreaProps and MediaSharingModal (either required or safely optional), and
  • MediaSharingModal still hides/blocks presenter-only actions for non-moderators/non-presenters.

Also applies to: 41-73

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

349-358: Persisting requestedPresenter is wired correctly, but DAO filter should likely include meetingId

The new setUserRequestedPresenter helper and requestedPresenter field on UserState follow existing patterns (copy, save, DAO update) and keep prior code compatible via the default value.

However, setUserRequestedPresenter calls UserStateDAO.updateRequestedPresenter(u.intId, requested), and the DAO implementation only filters by userId. Other UserStateDAO.update* methods filter by both meetingId and userId, which avoids accidentally touching multiple rows if userId is not globally unique.

To keep behavior consistent and safer, consider:

- def updateRequestedPresenter(userId: String, requestedPresenter: Boolean) = {
+ def updateRequestedPresenter(meetingId: String, userId: String, requestedPresenter: Boolean) = {
-   TableQuery[UserStateDbTableDef]
-     .filter(_.userId === userId)
+   TableQuery[UserStateDbTableDef]
+     .filter(_.meetingId === meetingId)
+     .filter(_.userId === userId)
      .map(_.requestedPresenter)
      .update(requestedPresenter)
  }

and in setUserRequestedPresenter:

- UserStateDAO.updateRequestedPresenter(u.intId, requested)
+ UserStateDAO.updateRequestedPresenter(u.meetingId, u.intId, requested)

Also applies to: 447-479

bigbluebutton-html5/imports/ui/components/request-presenter-modal/styles.js (1)

129-176: Use theme color variables instead of hardcoded values.

Several hardcoded color values break theming consistency. The file already imports colorWhite and colorText but doesn't use them consistently.

 const ConfirmationButton = styled.button`
   background-color: ${btnPrimaryBg};
-  color: white;
+  color: ${colorWhite};
   padding: 10px 24px;
   ...
 `;

 const CancelButton = styled.button`
   background-color: transparent;
-  color: #333;
+  color: ${colorText};
   ...
   &:hover {
-    background-color: #f4f4f4;
+    background-color: var(--color-gray-lightest, #f4f4f4);
   }
 `;

 const TitleText = styled.h3`
   font-size: 1.125rem;
-  color: #333;
+  color: ${colorText};
   ...
 `;

 const DescriptionText = styled.p`
   font-size: 1rem;
-  color: #666;
+  color: var(--color-gray-dark, #666);
   ...
 `;
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala (1)

50-72: Avoid return statement inside for-comprehension.

Using return inside a for-comprehension is non-idiomatic Scala and can lead to unexpected behavior in some contexts. Consider restructuring to use pattern matching or early return at the top level.

       } else {
-        for {
-          requester <- Users2x.findWithIntId(liveMeeting.users2x, requesterId)
-        } yield {
-          // Reset the request flag
-          Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, false)
-
-          if (approved) {
-            // Build and send AssignPresenterReqMsg to assign the specific user as presenter
-            val assignMsg = AssignPresenterReqMsg(
-              BbbClientMsgHeader(AssignPresenterReqMsg.NAME, meetingId, senderId),
-              AssignPresenterReqMsgBody(senderId, requesterId)
-            )
-            val newState = handlePresenterChange(assignMsg, state)
-
-            log.info("Presenter request approved. meetingId=" + meetingId +
-              " requesterId=" + requesterId + " approvedBy=" + senderId)
-            return newState
-          } else {
-            log.info("Presenter request denied. meetingId=" + meetingId +
-              " requesterId=" + requesterId + " deniedBy=" + senderId)
-          }
-        }
-        state
+        Users2x.findWithIntId(liveMeeting.users2x, requesterId) match {
+          case Some(requester) =>
+            Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, false)
+            if (approved) {
+              val assignMsg = AssignPresenterReqMsg(
+                BbbClientMsgHeader(AssignPresenterReqMsg.NAME, meetingId, senderId),
+                AssignPresenterReqMsgBody(senderId, requesterId)
+              )
+              log.info("Presenter request approved. meetingId=" + meetingId +
+                " requesterId=" + requesterId + " approvedBy=" + senderId)
+              handlePresenterChange(assignMsg, state)
+            } else {
+              log.info("Presenter request denied. meetingId=" + meetingId +
+                " requesterId=" + requesterId + " deniedBy=" + senderId)
+              state
+            }
+          case None => state
+        }
       }
bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx (2)

19-21: Consider handling subscription errors.

The subscription may fail due to network issues or permissions. Currently, errors are silently ignored. Consider destructuring and handling the error property.

-  const { data: presenterRequestData } = useSubscription(PRESENTER_REQUEST_SUBSCRIPTION, {
+  const { data: presenterRequestData, error: subscriptionError } = useSubscription(PRESENTER_REQUEST_SUBSCRIPTION, {
     skip: !isModerator,
   });
+
+  if (subscriptionError) {
+    // Log or handle subscription error appropriately
+    console.error('Presenter request subscription error:', subscriptionError);
+  }

25-49: Add error handling to mutation callbacks.

If the mutation fails (network error, permission denied), the toast will be dismissed but the request flag may remain set in the database, causing stale notifications.

   const handleApprove = useCallback(
     (requesterId) => {
       setPresenterRequest({
         variables: {
           requestedPresenter: false,
           userId: requesterId,
           approved: true,
         },
-      });
+      }).catch((error) => {
+        console.error('Failed to approve presenter request:', error);
+      });
     },
     [setPresenterRequest],
   );

   const handleDeny = useCallback(
     (requesterId) => {
       setPresenterRequest({
         variables: {
           requestedPresenter: false,
           userId: requesterId,
           approved: false,
         },
-      });
+      }).catch((error) => {
+        console.error('Failed to deny presenter request:', error);
+      });
     },
     [setPresenterRequest],
   );
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0341e07 and a54f10e.

📒 Files selected for processing (23)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserStateDAO.scala (5 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala (2 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala (1 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1 hunks)
  • bbb-graphql-actions/src/actions/userSetPresenterRequest.ts (1 hunks)
  • bbb-graphql-server/bbb_schema.sql (5 hunks)
  • bbb-graphql-server/metadata/actions.graphql (1 hunks)
  • bbb-graphql-server/metadata/actions.yaml (1 hunks)
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user.yaml (1 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx (5 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/types.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/app/component.tsx (2 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter-modal/mutations.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter-modal/styles.js (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter-modal/subscriptions.ts (1 hunks)
  • bigbluebutton-html5/public/locales/en.json (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-15T17:52:37.432Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/pt.json:323-323
Timestamp: 2025-10-15T17:52:37.432Z
Learning: Translation issues in locale files (bigbluebutton-html5/public/locales/*.json) should be updated in Transifex, the translation management platform used by the BigBlueButton project, rather than being fixed directly in pull requests.

Applied to files:

  • bigbluebutton-html5/public/locales/en.json
📚 Learning: 2025-10-15T17:57:46.195Z
Learnt from: guiiBecker
Repo: bigbluebutton/bigbluebutton PR: 24084
File: bigbluebutton-html5/public/locales/ja.json:723-727
Timestamp: 2025-10-15T17:57:46.195Z
Learning: In the bigbluebutton repository, locale files (e.g., public/locales/*.json) are managed through Transifex and should not be edited directly in pull requests. Translation corrections and updates should be made in Transifex, which then syncs to the repository.

Applied to files:

  • bigbluebutton-html5/public/locales/en.json
📚 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/db/UserStateDAO.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
🧬 Code graph analysis (11)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx (2)
bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (1)
  • toastId (236-236)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx (2)
  • handleDeny (38-49)
  • handleApprove (25-36)
bbb-graphql-actions/src/actions/userSetPresenterRequest.ts (2)
bbb-graphql-middleware/internal/common/types.go (1)
  • RedisMessage (99-108)
bbb-graphql-actions/src/imports/validation.ts (1)
  • throwErrorIfInvalidInput (29-126)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala (1)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (2)
  • UserSetPresenterRequestReqMsg (481-481)
  • UserSetPresenterRequestReqMsg (482-482)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala (4)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala (4)
  • Users2x (8-359)
  • Users2x (361-439)
  • findWithIntId (9-11)
  • setUserRequestedPresenter (349-358)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala (4)
  • MeetingActor (56-64)
  • MeetingActor (66-1265)
  • props (57-64)
  • handlePresenterChange (963-972)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala (1)
  • props (15-17)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (3)
  • AssignPresenterReqMsg (279-279)
  • AssignPresenterReqMsg (280-280)
  • AssignPresenterReqMsgBody (281-281)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx (5)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/mutations.ts (1)
  • USER_SET_PRESENTER_REQUEST (3-11)
bigbluebutton-html5/imports/ui/components/connection-status/component.jsx (1)
  • useCurrentUser (211-221)
bigbluebutton-html5/imports/ui/core/hooks/createUseSubscription.ts (1)
  • useSubscription (152-235)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/subscriptions.ts (1)
  • PRESENTER_REQUEST_SUBSCRIPTION (3-11)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx (1)
  • RequestPresenterNotification (37-108)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserStateDAO.scala (2)
  • UserStateDAO (70-184)
  • updateRequestedPresenter (150-157)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx (2)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx (1)
  • setPresenterRequest (11-11)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/mutations.ts (1)
  • USER_SET_PRESENTER_REQUEST (3-11)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx (4)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx (1)
  • intlMessages (18-35)
bigbluebutton-html5/imports/ui/components/presentation/presentation-toolbar/component.jsx (1)
  • intlMessages (24-109)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/presentation/component.jsx (1)
  • intlMessages (49-122)
bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx (1)
  • amIPresenter (94-94)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/styles.js (2)
bigbluebutton-html5/imports/ui/stylesheets/styled-components/general.js (5)
  • $2xlPadding (27-27)
  • appsButtonsBorderRadius (127-127)
  • jumboPaddingY (19-19)
  • borderSizeSmall (7-7)
  • lgBorderRadius (11-11)
bigbluebutton-html5/imports/ui/stylesheets/styled-components/palette.js (7)
  • colorWhite (1-1)
  • colorText (45-45)
  • colorPrimary (29-29)
  • btnPrimaryHoverBg (64-64)
  • colorDanger (30-30)
  • btnDangerBgHover (78-78)
  • btnPrimaryBg (63-63)
bigbluebutton-html5/imports/ui/components/app/component.tsx (1)
bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx (1)
  • RequestPresenterContainer (10-69)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala (1)
  • handleUserSetPresenterRequestReqMsg (15-77)
🪛 GitHub Check: SonarCloud Code Analysis
bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx

[failure] 5-5: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJPCNjN-lnv0u95&open=AZr_2WJPCNjN-lnv0u95&pullRequest=24341


[warning] 47-47: Prefer globalThis over window.

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJPCNjN-lnv0u97&open=AZr_2WJPCNjN-lnv0u97&pullRequest=24341


[warning] 47-47: Prefer globalThis over window.

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJPCNjN-lnv0u96&open=AZr_2WJPCNjN-lnv0u96&pullRequest=24341

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala

[failure] 23-23: Define a constant instead of duplicating this literal " requesterId=" 6 times.

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJ0CNjN-lnv0u99&open=AZr_2WJ0CNjN-lnv0u99&pullRequest=24341

bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx

[failure] 8-8: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJYCNjN-lnv0u98&open=AZr_2WJYCNjN-lnv0u98&pullRequest=24341

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

[failure] 17-17: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WCQCNjN-lnv0u9x&open=AZr_2WCQCNjN-lnv0u9x&pullRequest=24341

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx

[warning] 376-376: Unexpected negated condition.

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WIyCNjN-lnv0u9y&open=AZr_2WIyCNjN-lnv0u9y&pullRequest=24341

bigbluebutton-html5/imports/ui/components/request-presenter-modal/styles.js

[failure] 3-3: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJGCNjN-lnv0u91&open=AZr_2WJGCNjN-lnv0u91&pullRequest=24341


[failure] 20-20: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJGCNjN-lnv0u94&open=AZr_2WJGCNjN-lnv0u94&pullRequest=24341


[failure] 4-4: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJGCNjN-lnv0u92&open=AZr_2WJGCNjN-lnv0u92&pullRequest=24341


[failure] 2-2: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJGCNjN-lnv0u90&open=AZr_2WJGCNjN-lnv0u90&pullRequest=24341


[failure] 13-13: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJGCNjN-lnv0u93&open=AZr_2WJGCNjN-lnv0u93&pullRequest=24341

bigbluebutton-html5/imports/ui/components/app/component.tsx

[failure] 53-53: Do not import modules using an absolute path

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WI8CNjN-lnv0u9z&open=AZr_2WI8CNjN-lnv0u9z&pullRequest=24341

⏰ 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). (6)
  • GitHub Check: Agent
  • GitHub Check: build-package (bbb-fsesl-akka)
  • GitHub Check: build-package (bbb-html5)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-apps-akka)
🔇 Additional comments (14)
bigbluebutton-html5/public/locales/en.json (1)

504-507: New request‑presenter i18n keys look consistent

Keys and placeholders are well‑formed and aligned with existing “Take presenter” copy; no functional issues here.

Also applies to: 764-765

bbb-graphql-server/bbb_schema.sql (1)

309-312: requestedPresenter flag and view propagation look consistent

The requestedPresenter column is added to user with a safe default and correctly propagated to v_user, v_user_current, and v_user_ref, so both live and reference views can expose it to GraphQL and other readers. Adding uploadCompletionNotified to v_pres_presentation also matches the underlying table schema.

No relational or trigger side effects here; this schema change looks structurally sound.

Also applies to: 396-440, 456-510, 537-576, 1523-1550

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

114-115: Routing of UserSetPresenterRequestReqMsg is correct

New presenter‑request messages are routed via routeGenericMsg[UserSetPresenterRequestReqMsg] in line with other user‑scoped messages; this integrates cleanly into the existing dispatcher.

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/types.ts (1)

27-45: MediaAreaProps updated correctly for request‑presenter flow

Adding handleRequestPresenter to MediaAreaProps aligns with how the container and modal now use this callback; the typings are consistent and non‑breaking.

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

581-585: Presenter request message handling is consistent with existing patterns

The new UserSetPresenterRequestReqMsg case updates the sender’s last activity and delegates to handleUserSetPresenterRequestReqMsg, matching how similar user actions (e.g., presenter changes, mute flows) are wired. This should integrate cleanly with the new handler trait and state updates.

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

80-133: Exposing requestedPresenter in v_user looks appropriate

Adding requestedPresenter to the bbb_client selectable columns is consistent with other user-state fields (e.g., raiseHand, presenter) and needed for the UI to reflect request status. The existing row filter remains unchanged, so access control is preserved.

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

746-748: userSetPresenterRequest mutation signature aligns with backend expectations

The mutation’s arguments (requestedPresenter!, optional userId, optional approved) match the action handler and Scala message shape, allowing:

  • viewers to request (requestedPresenter: true, no userId/approved), and
  • moderators to answer (requestedPresenter: false, userId, approved).

No issues from a schema/typing standpoint.

bigbluebutton-html5/imports/ui/components/request-presenter-modal/mutations.ts (1)

1-15: GraphQL mutation constant is correctly defined and exported

The USER_SET_PRESENTER_REQUEST mutation matches the SDL (variable names and types) and is exported in a way that fits the existing pattern for UI mutations.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala (1)

5-18: Including UserSetPresenterRequestReqMsgHdlr in UsersApp2x is correct

Extending UsersApp2x with UnmuteRequestAnswerEvtMsgHdlr and UserSetPresenterRequestReqMsgHdlr is the right way to expose these message handlers on MeetingActor via the existing self-type. This keeps handler composition consistent.

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

1-36: Redis message builder matches the new presenter-request protocol

The action correctly:

  • validates requestedPresenter, userId, and approved types,
  • pulls currentUserId and meetingId from session variables,
  • sets requesterId to either the explicit userId (for moderator approval/denial) or the current user (for viewer requests),
  • defaults approved to false when omitted (viewer request case).

This lines up with UserSetPresenterRequestReqMsg handling on the Scala side.

Two minor things to double-check:

  • That sessionVariables['x-hasura-userid'] / ['x-hasura-meetingid'] match the exact keys configured in Hasura auth.
  • That the UI never calls this with requestedPresenter: false from a viewer, since the server-side permission check will eject non-moderators in that branch.
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1)

480-483: LGTM!

The new UserSetPresenterRequestReqMsg message type follows the established conventions in this file. The message body appropriately captures the requester ID, request status flag, and approval decision needed for the presenter request workflow.

bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx (1)

46-105: Verify intentional omission of dependencies in useEffect.

The useEffect has an empty dependency array but references intl, requesterName, requesterId, handleDeny, and handleApprove. This is likely intentional since the toast should only be created once on mount, but React's exhaustive-deps rule would flag this. Consider adding a comment to clarify intent.

-  }, []);
+  // eslint-disable-next-line react-hooks/exhaustive-deps -- Toast should only be created once on mount
+  }, []);
bbb-graphql-server/metadata/actions.yaml (1)

669-675: LGTM!

The new userSetPresenterRequest action follows the established pattern for Hasura actions in this file, with appropriate synchronous handling and bbb_client role permissions.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala (1)

33-34: Moderator path logs but takes no action.

When a moderator requests presenter rights, the code logs that they "can become presenter directly" but doesn't actually assign them as presenter. Should this call handlePresenterChange to make them presenter?

         } else if (requester.role == Roles.MODERATOR_ROLE) {
-          log.info("Moderator can become presenter directly. meetingId=" + meetingId + " requesterId=" + requesterId)
+          log.info("Moderator becoming presenter directly. meetingId=" + meetingId + " requesterId=" + requesterId)
+          val assignMsg = AssignPresenterReqMsg(
+            BbbClientMsgHeader(AssignPresenterReqMsg.NAME, meetingId, requesterId),
+            AssignPresenterReqMsgBody(requesterId, requesterId)
+          )
+          return handlePresenterChange(assignMsg, state)
         } else {

Comment on lines +150 to +157
def updateRequestedPresenter(userId: String, requestedPresenter: Boolean) = {
DatabaseConnection.enqueue(
TableQuery[UserStateDbTableDef]
.filter(_.userId === userId)
.map(u => u.requestedPresenter)
.update(requestedPresenter)
)
}

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.

⚠️ Potential issue | 🟠 Major

Missing meetingId filter in updateRequestedPresenter.

This method only filters by userId, unlike all other similar methods in this DAO (e.g., updateRequestedUnmuteByMod at lines 140-148) which filter by both meetingId and userId. This could cause issues if user IDs aren't globally unique across concurrent meetings.

-  def updateRequestedPresenter(userId: String, requestedPresenter: Boolean) = {
+  def updateRequestedPresenter(meetingId: String, userId: String, requestedPresenter: Boolean) = {
     DatabaseConnection.enqueue(
       TableQuery[UserStateDbTableDef]
+        .filter(_.meetingId === meetingId)
         .filter(_.userId === userId)
         .map(u => u.requestedPresenter)
         .update(requestedPresenter)
     )
   }

This will also require updating the call site in Users2x.setUserRequestedPresenter to pass the meetingId.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def updateRequestedPresenter(userId: String, requestedPresenter: Boolean) = {
DatabaseConnection.enqueue(
TableQuery[UserStateDbTableDef]
.filter(_.userId === userId)
.map(u => u.requestedPresenter)
.update(requestedPresenter)
)
}
def updateRequestedPresenter(meetingId: String, userId: String, requestedPresenter: Boolean) = {
DatabaseConnection.enqueue(
TableQuery[UserStateDbTableDef]
.filter(_.meetingId === meetingId)
.filter(_.userId === userId)
.map(u => u.requestedPresenter)
.update(requestedPresenter)
)
}
🤖 Prompt for AI Agents
In akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserStateDAO.scala
around lines 150 to 157, the updateRequestedPresenter method only filters by
userId which can incorrectly target users across meetings; change the method
signature to accept meetingId: String as an additional parameter, update the
DatabaseConnection.enqueue query to filter on both _.meetingId === meetingId and
_.userId === userId before mapping to u.requestedPresenter and performing the
update, and then update the call site Users2x.setUserRequestedPresenter to pass
the meetingId when invoking this DAO method.

Comment on lines +46 to +48
useEffect(() => {
const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
alert.play();

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.

⚠️ Potential issue | 🟡 Minor

Handle potential audio playback failure.

Audio.play() returns a Promise that can reject if the browser blocks autoplay (common on mobile or when user hasn't interacted with the page). Unhandled promise rejections can cause issues.

   useEffect(() => {
     const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
-    alert.play();
+    alert.play().catch(() => {
+      // Autoplay may be blocked by browser policy
+    });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
alert.play();
useEffect(() => {
const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
alert.play().catch(() => {
// Autoplay may be blocked by browser policy
});
🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis

[warning] 47-47: Prefer globalThis over window.

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJPCNjN-lnv0u97&open=AZr_2WJPCNjN-lnv0u97&pullRequest=24341


[warning] 47-47: Prefer globalThis over window.

See more on https://sonarcloud.io/project/issues?id=bigbluebutton_bigbluebutton&issues=AZr_2WJPCNjN-lnv0u96&open=AZr_2WJPCNjN-lnv0u96&pullRequest=24341

🤖 Prompt for AI Agents
In
bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx
around lines 46–48, the code calls alert.play() without handling the returned
Promise; wrap the play() call so its Promise is handled (e.g., call
alert.play().catch(err => { /* handle or log error */ }) or await it inside an
async effect and catch errors) to prevent unhandled promise rejections when
autoplay is blocked by the browser; include a minimal handler that logs the
error and falls back gracefully (no-op) so the app continues to function.

Copilot AI 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.

Pull request overview

This PR implements a "Request to Become Presenter" feature that allows non-presenter viewers to request the presenter role from moderators. The feature adds a new UI flow where viewers see a "Request presenter" button (instead of "Take presenter"), and moderators receive real-time toast notifications with approve/deny actions for each request.

Key Changes

  • Added requestedPresenter boolean flag to user state across the full stack (database, GraphQL schema, Scala models)
  • Implemented a GraphQL subscription-based notification system that monitors presenter requests and displays stacked toast notifications to moderators
  • Modified the media area UI to show "Request presenter" button for non-moderator viewers while maintaining "Take presenter" for moderators

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
bigbluebutton-html5/public/locales/en.json Added localization strings for presenter request notifications and button labels
bigbluebutton-html5/imports/ui/components/request-presenter-modal/component.jsx Notification component that displays toast with approve/deny actions; has critical useEffect dependency issue
bigbluebutton-html5/imports/ui/components/request-presenter-modal/container.jsx Container managing GraphQL subscription for presenter requests and callback handlers
bigbluebutton-html5/imports/ui/components/request-presenter-modal/subscriptions.ts GraphQL subscription to fetch users with requestedPresenter=true
bigbluebutton-html5/imports/ui/components/request-presenter-modal/mutations.ts GraphQL mutation for setting presenter request state
bigbluebutton-html5/imports/ui/components/request-presenter-modal/styles.js Styled components for notifications; contains hardcoded colors instead of theme tokens
bigbluebutton-html5/imports/ui/components/app/component.tsx Integrated RequestPresenterContainer into main app layout
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx Modified condition to show media area button for all users (not just presenters/moderators)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx Added handleRequestPresenter callback using GraphQL mutation
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx Updated UI to conditionally show "Request presenter" or "Take presenter" based on moderator status
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/types.ts Added handleRequestPresenter to type definitions
bbb-graphql-server/bbb_schema.sql Added requestedPresenter boolean column to user table with default FALSE
bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user.yaml Added requestedPresenter to select permissions
bbb-graphql-server/metadata/actions.yaml Added userSetPresenterRequest action with bbb_client permission
bbb-graphql-server/metadata/actions.graphql Defined userSetPresenterRequest mutation signature
bbb-graphql-actions/src/actions/userSetPresenterRequest.ts GraphQL action handler that builds Redis message for presenter requests
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala Defined Scala message case classes for presenter request messages
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala Added handler routing for UserSetPresenterRequestReqMsg
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala Added message routing for presenter request messages
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala Added setUserRequestedPresenter method and requestedPresenter field to UserState
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/UserStateDAO.scala Added database update logic for requestedPresenter field
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp2x.scala Added UserSetPresenterRequestReqMsgHdlr trait to users app
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserSetPresenterRequestReqMsgHdlr.scala Message handler implementing request/approve/deny logic; has security concerns around permission checks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

pres_presentation."downloadFileUri",
pres_presentation."removable",
pres_presentation."uploadCompletionNotified",
pres_presentation."uploadCompletionNotified",

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

Unrelated whitespace-only change detected. This line modifies indentation from a tab to spaces, which appears unrelated to the presenter request feature.

Recommendation: Revert this change to keep the diff focused on the feature being implemented:

	pres_presentation."uploadCompletionNotified",
Suggested change
pres_presentation."uploadCompletionNotified",
pres_presentation."uploadCompletionNotified",

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +41
if (requestedPresenter && senderId == requesterId) {
for {
requester <- Users2x.findWithIntId(liveMeeting.users2x, requesterId)
} yield {
if (requester.presenter) {
log.info("User is already presenter. meetingId=" + meetingId + " requesterId=" + requesterId)
} else if (requester.role == Roles.MODERATOR_ROLE) {
log.info("Moderator can become presenter directly. meetingId=" + meetingId + " requesterId=" + requesterId)
} else {
Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, true)
log.info("User requested presenter. meetingId=" + meetingId +
" requesterId=" + requesterId + " requesterName=" + requester.name)
}
}
state

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

A user can request presenter rights on behalf of another user by manipulating the requesterId parameter. The code checks senderId == requesterId but doesn't validate that when setting the request flag, the requesterId must always be the senderId. A malicious user could potentially set the presenter request flag for other users.

Recommendation: Enforce that users can only request presenter for themselves:

if (requestedPresenter && senderId != requesterId) {
  val reason = "Cannot request presenter for another user."
  PermissionCheck.ejectUserForFailedPermission(meetingId, senderId, reason, outGW, liveMeeting)
  state
} else if (requestedPresenter && senderId == requesterId) {
  // existing logic
}

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +39
Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, true)
log.info("User requested presenter. meetingId=" + meetingId +
" requesterId=" + requesterId + " requesterName=" + requester.name)
}

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

No check for duplicate presenter requests. A user can repeatedly call this endpoint to spam moderators with multiple notifications, even if they already have an active presenter request pending.

Recommendation: Check if the user already has a pending request before setting the flag:

} else {
  if (requester.requestedPresenter) {
    log.info("User already has a pending presenter request. meetingId=" + meetingId + " requesterId=" + requesterId)
  } else {
    Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, true)
    log.info("User requested presenter. meetingId=" + meetingId +
      " requesterId=" + requesterId + " requesterName=" + requester.name)
  }
}

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +103
if (toastIdRef.current) {
toast.dismiss(toastIdRef.current);
}

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

The cleanup function dismisses using toastIdRef.current, but the toast was created with a string ID presenter-request-${requesterId} (line 65). The cleanup should use the same string ID to ensure proper dismissal.

Recommendation: Update the cleanup to use the consistent toast ID:

return () => {
  toast.dismiss(`presenter-request-${requesterId}`);
};

Alternatively, if you want to keep using the ref, store the string ID instead:

const toastId = `presenter-request-${requesterId}`;
toastIdRef.current = toastId;
// ... use toastId throughout
Suggested change
if (toastIdRef.current) {
toast.dismiss(toastIdRef.current);
}
toast.dismiss(`presenter-request-${requesterId}`);

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +66
{presenterRequests.map((request) => (
<RequestPresenterNotification
key={request.userId}
intl={intl}
handleApprove={() => handleApprove(request.userId)}
handleDeny={() => handleDeny(request.userId)}
requesterName={request.name}
requesterId={request.userId}
/>
))}

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

Creating inline arrow functions in JSX (lines 61-62) causes new function instances on every render, which can trigger unnecessary re-renders in child components and may cause issues with the toast notification system that expects stable references.

Recommendation: Move the callback creation outside the map or use useCallback:

{presenterRequests.map((request) => {
  const handleApproveRequest = () => handleApprove(request.userId);
  const handleDenyRequest = () => handleDeny(request.userId);
  
  return (
    <RequestPresenterNotification
      key={request.userId}
      intl={intl}
      handleApprove={handleApproveRequest}
      handleDeny={handleDenyRequest}
      requesterName={request.name}
      requesterId={request.userId}
    />
  );
})}

However, given that each notification is only rendered once per request, this is more of a minor optimization.

Suggested change
{presenterRequests.map((request) => (
<RequestPresenterNotification
key={request.userId}
intl={intl}
handleApprove={() => handleApprove(request.userId)}
handleDeny={() => handleDeny(request.userId)}
requesterName={request.name}
requesterId={request.userId}
/>
))}
{presenterRequests.map((request) => {
const handleApproveRequest = useCallback(() => handleApprove(request.userId), [handleApprove, request.userId]);
const handleDenyRequest = useCallback(() => handleDeny(request.userId), [handleDeny, request.userId]);
return (
<RequestPresenterNotification
key={request.userId}
intl={intl}
handleApprove={handleApproveRequest}
handleDeny={handleDenyRequest}
requesterName={request.name}
requesterId={request.userId}
/>
);
})}

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +11
export const PRESENTER_REQUEST_SUBSCRIPTION = gql`
subscription presenterRequestSubscription {
user(where: { requestedPresenter: { _eq: true } }) {
userId
name
requestedPresenter
}
}
`;

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The subscription lacks a descriptive comment explaining its purpose and behavior. This makes it harder for future developers to understand what data this subscription fetches and when it triggers.

Recommendation: Add a JSDoc comment:

/**
 * Subscription to monitor users who have requested presenter role.
 * Returns all users where requestedPresenter flag is true.
 * Used by moderators to receive real-time notifications of presenter requests.
 */
export const PRESENTER_REQUEST_SUBSCRIPTION = gql`
  // ...
`;

Copilot uses AI. Check for mistakes.
toast.dismiss(toastIdRef.current);
}
};
}, []);

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

The useEffect hook has an empty dependency array but uses several props (intl, requesterName, requesterId, handleApprove, handleDeny) inside it. This violates the React exhaustive-deps rule and can lead to stale closure issues where the effect captures outdated values of these props.

Recommendation: Add all used dependencies to the dependency array:

useEffect(() => {
  // ... effect code
}, [intl, requesterName, requesterId, handleApprove, handleDeny]);

This ensures the effect re-runs when any of these values change, preventing stale closures and ensuring the notification always has the latest prop values.

Suggested change
}, []);
}, [intl, requesterName, requesterId, handleApprove, handleDeny]);

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +38
Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, true)
log.info("User requested presenter. meetingId=" + meetingId +
" requesterId=" + requesterId + " requesterName=" + requester.name)

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

Missing permission check when a user sets their own presenter request flag. The code only verifies that the user is not already a presenter or moderator but doesn't check if non-moderator users have permission to request presenter rights. This could allow any viewer (even guests) to flood moderators with presenter requests.

Recommendation: Add a permission check before allowing users to set the request flag:

if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.VIEWER_LEVEL,
  liveMeeting.users2x, senderId)) {
  val reason = "No permission to request presenter."
  PermissionCheck.ejectUserForFailedPermission(meetingId, senderId, reason, outGW, liveMeeting)
  state
} else {
  // existing logic
}
Suggested change
Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, true)
log.info("User requested presenter. meetingId=" + meetingId +
" requesterId=" + requesterId + " requesterName=" + requester.name)
if (permissionFailed(PermissionCheck.GUEST_LEVEL, PermissionCheck.VIEWER_LEVEL,
liveMeeting.users2x, senderId)) {
val reason = "No permission to request presenter."
PermissionCheck.ejectUserForFailedPermission(meetingId, senderId, reason, outGW, liveMeeting)
} else {
Users2x.setUserRequestedPresenter(liveMeeting.users2x, requesterId, true)
log.info("User requested presenter. meetingId=" + meetingId +
" requesterId=" + requesterId + " requesterName=" + requester.name)
}

Copilot uses AI. Check for mistakes.

useEffect(() => {
const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
alert.play();

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

Audio playback may fail silently. Modern browsers require user interaction before allowing audio playback. If the notification triggers without prior user interaction, the alert.play() call will fail with a DOMException but is not being caught.

Recommendation: Add error handling for the audio playback:

const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
alert.play().catch((error) => {
  console.warn('Failed to play notification sound:', error);
});
Suggested change
alert.play();
alert.play().catch((error) => {
console.warn('Failed to play notification sound:', error);
});

Copilot uses AI. Check for mistakes.
Comment on lines +150 to +173
color: #333;
padding: 10px 24px;
font-size: 1rem;
font-weight: 400;
cursor: pointer;
margin-right: 16px;
border-radius: ${lgBorderRadius};
border: none;

&:hover {
background-color: #f4f4f4;
}
`;

const TitleText = styled.h3`
font-size: 1.125rem;
color: #333;
font-weight: 700;
margin-bottom: 8px;
`;

const DescriptionText = styled.p`
font-size: 1rem;
color: #666;

Copilot AI Dec 8, 2025

Copy link

Choose a reason for hiding this comment

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

Hardcoded color values (#333 on line 150, #f4f4f4 on line 160, #666 on line 173) are used instead of theme tokens from the palette. This breaks consistency with the app's theming system and won't adapt to dark mode or custom themes.

Recommendation: Use theme tokens from the imported palette:

const CancelButton = styled.button`
  background-color: transparent;
  color: ${colorText};  // instead of #333
  // ...
  &:hover {
    background-color: ${colorWhite};  // or appropriate hover color from palette
  }
`;

const TitleText = styled.h3`
  // ...
  color: ${colorText};  // instead of #333
`;

const DescriptionText = styled.p`
  // ...
  color: ${colorGrayLight};  // instead of #666
`;

Copilot uses AI. Check for mistakes.
@lfzawacki
lfzawacki self-requested a review December 9, 2025 17:03
…r presenter requests

- Show "Waiting for moderator..." button state while request is pending
- Display error notification when moderator denies presenter request

@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

Caution

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

⚠️ Outside diff range comments (1)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx (1)

23-44: Verify that handleRequestPresenter is defined and provided to RequestPresenterAlert (MediaSharingModal)

The MediaSharingModalProps interface declares handleRequestPresenter as required (line 34), and at line 159 of the media-sharing component, clicking the "request presenter" button calls this.props.handleRequestPresenter(). However, in the MediaArea component (line 206-207), RequestPresenterAlert is passed handleRequestPresenter={handleRequestPresenter}, but the variable handleRequestPresenter is neither defined in the component nor present in the destructured props. This will cause a runtime error when non-moderators attempt to request presenter access.

♻️ Duplicate comments (4)
bigbluebutton-html5/imports/ui/components/request-presenter/component.jsx (2)

105-105: Add all dependencies to useEffect to prevent stale closures.

The useEffect has an empty dependency array but uses intl, requesterName, requesterId, handleApprove, and handleDeny. This violates React's exhaustive-deps rule and causes stale closures where the effect captures outdated prop values. If props change, the notification won't reflect the updates.

Apply this diff:

-  }, []);
+  }, [intl, requesterName, requesterId, handleApprove, handleDeny]);

Note: This will cause the effect to re-run when any dependency changes, creating a new toast. Consider whether this is the desired behavior, or if you should use refs to avoid re-creating notifications.


46-48: Handle audio playback promise rejection.

Audio.play() returns a Promise that can be rejected if the browser blocks autoplay (common on mobile or without prior user interaction). Unhandled promise rejections can cause console errors and impact user experience.

Apply this diff:

 const alert = new Audio(`${window.meetingClientSettings.public.app.cdn + window.meetingClientSettings.public.app.basename}/resources/sounds/notify.mp3`);
-alert.play();
+alert.play().catch((error) => {
+  console.warn('Failed to play notification sound:', error);
+});
bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (1)

55-66: Inline callbacks in map are fine here but could be extracted if you see re-render issues

Creating handleApprove/handleDeny lambdas inline in the map is acceptable given these notifications are short‑lived, but if you start seeing unnecessary re-renders in child components, you could prebind them per request (e.g., via small local functions or useCallback).

bigbluebutton-html5/imports/ui/components/request-presenter/styles.js (1)

129-190: Replace hardcoded colors with palette tokens for theme consistency

CancelButton, TitleText, DescriptionText, and PresenterIcon still use hardcoded colors (#333, #f4f4f4, #666, 'white') even though colorText, colorWhite, and related tokens are imported. To keep the Request Presenter UI aligned with theming (including dark mode/custom themes), consider switching these literals to the appropriate palette constants.

🧹 Nitpick comments (7)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx (1)

66-72: Consider debouncing or disabling during request.

The handleRequestPresenter mutation can be triggered multiple times in quick succession without protection. While isRequestingPresenter state exists, there's no guarantee the mutation completes before subsequent clicks.

Consider adding early return if already requesting:

 const handleRequestPresenter = useCallback(() => {
+  if (isRequestingPresenter) return;
   setPresenterRequest({
     variables: {
       requestedPresenter: true,
     },
   });
-}, [setPresenterRequest]);
+}, [setPresenterRequest, isRequestingPresenter]);
bigbluebutton-html5/imports/ui/components/request-presenter/mutations.ts (1)

3-11: Consider adding JSDoc to clarify dual-purpose mutation.

The mutation serves two distinct flows: (1) viewer requests presenter role (requestedPresenter: true, no userId/approved), and (2) moderator approves/denies request (requestedPresenter: false, userId + approved provided). This dual purpose isn't immediately clear.

Add documentation:

+/**
+ * Mutation to manage presenter requests.
+ * Use case 1 (viewer requests): { requestedPresenter: true }
+ * Use case 2 (moderator responds): { requestedPresenter: false, userId, approved }
+ */
 export const USER_SET_PRESENTER_REQUEST = gql`
   mutation userSetPresenterRequest($requestedPresenter: Boolean!, $userId: String, $approved: Boolean) {
bigbluebutton-html5/imports/ui/components/request-presenter/subscriptions.ts (1)

3-11: Add documentation for subscription purpose.

As noted in a previous review, the subscription lacks a descriptive comment explaining its purpose and when it triggers, making it harder for developers to understand the data flow.

Add JSDoc comment:

+/**
+ * Subscription to monitor users who have requested presenter role.
+ * Returns all users where requestedPresenter flag is true.
+ * Used by moderators to receive real-time notifications of presenter requests.
+ */
 export const PRESENTER_REQUEST_SUBSCRIPTION = gql`
   subscription presenterRequestSubscription {
     user(where: { requestedPresenter: { _eq: true } }) {
bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (1)

4-7: Consider using the shared subscription hook for consistency

This component uses useSubscription from the Apollo client directly; elsewhere in the codebase there is a custom useSubscription helper (e.g., in createUseSubscription.ts) that handles patching, projections, and stable return values. For consistency and to benefit from that behavior, consider switching this container to the shared hook unless there is a specific reason to bypass it.

Also applies to: 19-23

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (1)

44-61: Verify that all requesting → not requesting transitions truly mean “denied”

The effect treats any change from isRequestingPresenter === true to false while !amIPresenter as a denial and shows an error toast. If there are other flows that clear requestedPresenter (e.g., user leaving/rejoining, canceling the request, or backend resets), this may incorrectly surface as “denied”. Please confirm that the only such transition case is an explicit moderator denial, or consider distinguishing denial from other reset causes.

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx (2)

103-118: Clean up or wire up the new *Desc i18n messages

requestPresenterDesc and waitingForModeratorDesc are defined but not used in this component. If there’s no immediate consumer (e.g., tooltip or helper text), consider removing them to avoid unused translation keys, or wire them into the UI where appropriate.


330-373: Request presenter waiting state disables interaction until backend clears the flag

When isRequestingPresenter is true, the “must be presenter” view switches to a disabled WaitingButton with an hourglass and no cancel/retry option. That’s likely fine, but it means users can only close the modal and must rely entirely on server state to clear isRequestingPresenter. If moderators can take a long time or requests can get stuck, you may want a timeout/cancel affordance or a way to re‑send the request.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a54f10e and 57a896e.

📒 Files selected for processing (15)
  • bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (2 hunks)
  • bigbluebutton-html5/imports/ui/Types/user.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx (6 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/component.tsx (7 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/styles.ts (5 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/types.ts (2 hunks)
  • bigbluebutton-html5/imports/ui/components/app/component.tsx (2 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter/component.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter/mutations.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter/styles.js (1 hunks)
  • bigbluebutton-html5/imports/ui/components/request-presenter/subscriptions.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/core/graphql/queries/currentUserSubscription.ts (1 hunks)
  • bigbluebutton-html5/public/locales/en.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • bigbluebutton-html5/public/locales/en.json
🧰 Additional context used
🧬 Code graph analysis (4)
bigbluebutton-html5/imports/ui/components/app/component.tsx (1)
bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (1)
  • RequestPresenterContainer (10-69)
bigbluebutton-html5/imports/ui/components/request-presenter/component.jsx (3)
bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts (1)
  • Audio (221-224)
bigbluebutton-html5/imports/ui/components/presentation/presentation-menu/component.jsx (1)
  • toastId (236-236)
bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (2)
  • handleDeny (38-49)
  • handleApprove (25-36)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx (3)
bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (2)
  • currentUserData (13-15)
  • setPresenterRequest (11-11)
bigbluebutton-html5/imports/ui/components/connection-status/component.jsx (1)
  • useCurrentUser (211-221)
bigbluebutton-html5/imports/ui/components/request-presenter/mutations.ts (1)
  • USER_SET_PRESENTER_REQUEST (3-11)
bigbluebutton-html5/imports/ui/components/request-presenter/container.jsx (4)
bigbluebutton-html5/imports/ui/components/request-presenter/mutations.ts (1)
  • USER_SET_PRESENTER_REQUEST (3-11)
bigbluebutton-html5/imports/ui/components/connection-status/component.jsx (1)
  • useCurrentUser (211-221)
bigbluebutton-html5/imports/ui/core/hooks/createUseSubscription.ts (1)
  • useSubscription (152-235)
bigbluebutton-html5/imports/ui/components/request-presenter/subscriptions.ts (1)
  • PRESENTER_REQUEST_SUBSCRIPTION (3-11)
⏰ 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). (2)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-html5)
🔇 Additional comments (6)
bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_current.yaml (1)

216-216: LGTM!

The requestedPresenter field is correctly added to both bbb_client and bbb_client_not_in_meeting role permissions, properly exposing the new boolean field to authenticated clients. Placement alongside the similar requestedUnmuteByMod flag maintains consistency, and filter conditions ensure users can only query their own presenter request status.

Also applies to: 297-297

bigbluebutton-html5/imports/ui/Types/user.ts (2)

108-108: LGTM! Type definition is correct and consistent.

The requestedPresenter property is properly defined as an optional boolean, which is appropriate for representing a user's presenter request state. The implementation follows the same pattern as other optional boolean flags in the interface (e.g., presenter, pinned, bot), ensuring consistency.


120-129: [rewritten comment]
[classification tag]

bigbluebutton-html5/imports/ui/core/graphql/queries/currentUserSubscription.ts (1)

38-38: LGTM! Field addition follows existing patterns.

The requestedPresenter field addition is consistent with other boolean state fields in the subscription and properly supports the presenter request feature.

bigbluebutton-html5/imports/ui/components/app/component.tsx (1)

53-53: LGTM! Container integration follows React patterns.

The RequestPresenterContainer is correctly imported and rendered outside the main layout (after </Styled.Layout>), which is appropriate for overlay/modal-style notification components that need to render on top of the main content.

Also applies to: 200-200

bigbluebutton-html5/imports/ui/components/actions-bar/media-area/types.ts (1)

32-32: LGTM! Type additions are well-defined.

The new props handleRequestPresenter and isRequestingPresenter follow consistent patterns with existing interface members and properly support the presenter request workflow.

Also applies to: 45-45

Comment on lines +206 to +232
const WaitingButton = styled.button`
display: flex;
align-items: center;
justify-content: center;
padding: 12px 24px;
border-radius: 8px;
font-size: 1rem;
font-weight: 500;
background-color: #e0e0e0;
color: #666;
border: none;
cursor: not-allowed;
opacity: 0.7;

svg {
animation: spin 1.5s linear infinite;
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
`;

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.

🛠️ Refactor suggestion | 🟠 Major

Use palette constants instead of hardcoded color values.

The WaitingButton uses hardcoded colors (#e0e0e0, #666) while the rest of the file consistently imports and uses palette constants (e.g., colorDanger, colorWhite, colorPrimary). This violates the established styling pattern and makes theming/maintenance harder.

Apply this diff to use palette constants:

+import { colorGray } from '/imports/ui/stylesheets/styled-components/palette';
+
 const WaitingButton = styled.button`
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 12px 24px;
   border-radius: 8px;
   font-size: 1rem;
   font-weight: 500;
-  background-color: #e0e0e0;
-  color: #666;
+  background-color: ${colorGrayUserListToolbar};
+  color: ${colorGrayIcons};
   border: none;
   cursor: not-allowed;
   opacity: 0.7;

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/media-sharing/styles.ts
around lines 206 to 232, the WaitingButton uses hardcoded color values (#e0e0e0
and #666); import and use the project's palette constants instead (add the
palette import at the top of the file consistent with other components) and
replace the hardcoded background-color and color with the appropriate
disabled/neutral palette tokens used elsewhere (e.g., colorDisabledBackground /
colorDisabledText or the existing neutral/muted tokens in this file) so theming
remains consistent.

closeButton: false,
closeOnClick: false,
disablePointer: true,
toastId: `presenter-request-${requesterId}`,

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.

⚠️ Potential issue | 🟡 Minor

Toast ID inconsistency in creation and cleanup.

The toast is created with string ID presenter-request-${requesterId} (line 65) and stored in toastIdRef.current (line 98), but cleanup uses toastIdRef.current (line 102). The notify function's return value might differ from the provided toastId option, causing cleanup to fail.

Apply this diff for consistent cleanup:

 return () => {
-  if (toastIdRef.current) {
-    toast.dismiss(toastIdRef.current);
-  }
+  toast.dismiss(`presenter-request-${requesterId}`);
 };

Alternatively, remove the ref entirely if not needed:

-const toastIdRef = useRef(null);
-
 useEffect(() => {
   // ...
-  toastIdRef.current = toastId;
-
   return () => {
     toast.dismiss(`presenter-request-${requesterId}`);
   };

Also applies to: 98-98, 101-103

🤖 Prompt for AI Agents
In bigbluebutton-html5/imports/ui/components/request-presenter/component.jsx
around lines 65, 98 and 101-103, the toast is created with a provided string id
(`presenter-request-${requesterId}`) but the code uses toastIdRef.current for
cleanup which may not match the actual id returned by notify; update the
creation to capture the notify return value (assign the returned toast id to
toastIdRef.current) and use that stored id for closing/dismissing the toast, or
alternatively remove the ref and consistently use the literal id string for both
creation and cleanup so the same identifier is always used.

@antobinary antobinary added this to the Release 3.1 milestone Dec 15, 2025
@github-actions

Copy link
Copy Markdown

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

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57a896e and 2cd23bf.

📒 Files selected for processing (8)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala (2 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1 hunks)
  • bbb-graphql-server/bbb_schema.sql (5 hunks)
  • bbb-graphql-server/metadata/actions.graphql (1 hunks)
  • bigbluebutton-html5/imports/ui/Types/user.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/app/component.tsx (2 hunks)
  • bigbluebutton-html5/public/locales/en.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • bigbluebutton-html5/imports/ui/components/app/component.tsx
  • bigbluebutton-html5/public/locales/en.json
  • bigbluebutton-html5/imports/ui/Types/user.ts
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/Users2x.scala
  • bbb-graphql-server/bbb_schema.sql
🧰 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:

  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala
🧬 Code graph analysis (1)
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (2)
bigbluebutton-html5/imports/ui/components/request-presenter/component.jsx (1)
  • intlMessages (18-35)
bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx (1)
  • intlMessages (21-26)
⏰ 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-html5)
  • GitHub Check: build-package (bbb-web)
  • GitHub Check: build-package (bbb-graphql-server)
  • GitHub Check: build-package (bbb-apps-akka)
  • GitHub Check: build-package (bbb-fsesl-akka)
🔇 Additional comments (2)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala (1)

489-491: Naming inconsistency between GraphQL mutation and message body.

The GraphQL mutation uses userId: String (optional), but the message body uses requesterId: String (required). This mismatch creates confusion:

  • Is requesterId the user making the request, or the user whose request is being approved?
  • The type mismatch (optional vs. required) will complicate the adapter layer mapping GraphQL arguments to message fields.

Additionally, all fields in UserSetPresenterRequestReqMsgBody are non-optional, but semantically:

  • When a viewer requests presenter status, approved has no meaning yet
  • When a moderator approves a request, the semantic of requestedPresenter is unclear

Recommendation: Align naming with GraphQL (userId instead of requesterId) and consider using Option[Boolean] for fields that may be absent in certain scenarios, or split into two separate message types: UserRequestPresenterReqMsg and UserApprovePresenterRequestReqMsg.

⛔ 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.
bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx (1)

67-69: Authorization guards in MediaSharingModal properly restrict viewer access.

The relaxed rendering guard is safe. The MediaSharingModal component includes proper authorization checks:

  • Non-presenters see only "Take/Request Presenter" view, not the media sharing options
  • Presentation upload is guarded by amIPresenter check with early return for non-presenters
  • External video sharing is guarded by amIPresenter check
  • Camera as content is guarded by amIPresenter check
  • Screenshare button is disabled when not presenter

Viewers can access the media area but cannot perform any sharing actions—they can only request presenter role.

Comment on lines +746 to +748
type Mutation {
userSetPresenterRequest(requestedPresenter: Boolean!, userId: String, approved: Boolean): Boolean
}

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.

🛠️ Refactor suggestion | 🟠 Major

Consider splitting into two separate mutations for clarity.

The mutation userSetPresenterRequest conflates two distinct operations:

  1. A viewer requesting presenter status (requestedPresenter: true)
  2. A moderator approving/denying a request (approved: true/false)

This design creates semantic ambiguity:

  • When a viewer requests, what should approved be?
  • When a moderator approves, what should requestedPresenter be?
  • The optional userId adds confusion—when is it required vs. optional?

Recommendation: Split into two mutations aligned with single responsibility:

type Mutation {
  # Called by viewer to request presenter role
  userRequestPresenter: Boolean
}

type Mutation {
  # Called by moderator to approve/deny a request
  userApprovePresenterRequest(userId: String!, approved: Boolean!): Boolean
}

This separation clarifies intent, simplifies client logic, and makes authorization checks more explicit.

🤖 Prompt for AI Agents
In bbb-graphql-server/metadata/actions.graphql around lines 746-748, the single
mutation userSetPresenterRequest mixes two distinct actions (viewer requesting
presenter status and moderator approving/denying), causing semantic and
authorization ambiguity; refactor by replacing it with two focused mutations:
one for viewers to request presenter status with no arguments
(userRequestPresenter) and one for moderators to act on a specific user's
request requiring userId and an explicit approved boolean
(userApprovePresenterRequest(userId: String!, approved: Boolean!)), update
schema documentation, adjust resolvers and authorization checks accordingly, and
remove the old combined mutation.

Comment on lines +48 to +61
useEffect(() => {
if (
previousRequestedPresenter.current === true
&& isRequestingPresenter === false
&& !amIPresenter
) {
notify(
intl.formatMessage(intlMessages.presenterRequestDenied),
'error',
'presentation',
);
}
previousRequestedPresenter.current = isRequestingPresenter;
}, [isRequestingPresenter, amIPresenter, intl]);

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that isRequestingPresenter and amIPresenter come from the same data source

echo "=== Searching for MediaArea component file ==="
fd -e tsx "component.tsx" | grep -i "media-area"

echo -e "\n=== Searching for isRequestingPresenter prop usage and definition ==="
rg -n "isRequestingPresenter" --type ts --type tsx -B2 -A2 | head -50

echo -e "\n=== Searching for amIPresenter prop usage and definition ==="
rg -n "amIPresenter" --type ts --type tsx -B2 -A2 | head -50

echo -e "\n=== Looking for MediaArea container/parent component ==="
rg -n "MediaArea" --type ts --type tsx | grep -E "import|export|<MediaArea" | head -20

Repository: bigbluebutton/bigbluebutton

Length of output: 906


🏁 Script executed:

#!/bin/bash
# Adjusted search - look at the media-area directory structure first

echo "=== Media-area directory structure ==="
ls -la bigbluebutton-html5/imports/ui/components/actions-bar/media-area/

echo -e "\n=== Look for index files that might be the container ==="
find bigbluebutton-html5/imports/ui/components/actions-bar/media-area -name "index.*"

echo -e "\n=== Check if there's a container.ts or similar ==="
find bigbluebutton-html5/imports/ui/components/actions-bar/media-area -type f \( -name "*container*" -o -name "*index*" \)

echo -e "\n=== Read the component file to see prop definitions ==="
wc -l bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx

echo -e "\n=== Check first 100 lines of component.tsx for prop types ==="
head -100 bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx

echo -e "\n=== Search directly in the file for isRequestingPresenter and amIPresenter ==="
grep -n "isRequestingPresenter\|amIPresenter" bigbluebutton-html5/imports/ui/components/actions-bar/media-area/component.tsx

Repository: bigbluebutton/bigbluebutton

Length of output: 4564


🏁 Script executed:

#!/bin/bash
# Now examine the container.tsx to see how props are mapped

echo "=== Read container.tsx to see how props are connected ==="
cat -n bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

echo -e "\n=== Check types.ts for MediaAreaProps interface ==="
cat -n bigbluebutton-html5/imports/ui/components/actions-bar/media-area/types.ts

echo -e "\n=== Search for where isRequestingPresenter selector comes from ==="
rg -n "isRequestingPresenter" bigbluebutton-html5/imports/ui/components/actions-bar/media-area/

Repository: bigbluebutton/bigbluebutton

Length of output: 7893


🏁 Script executed:

#!/bin/bash
# Find where amIPresenter comes from in the parent component

echo "=== Search for the parent component that provides MediaAreaContainer ==="
rg -n "MediaAreaContainer" --type-list | head -20

echo -e "\n=== Find parent/main component that passes amIPresenter to MediaAreaContainer ==="
rg -n "<MediaAreaContainer" -B5 -A5

echo -e "\n=== Find useCurrentUser hook definition to understand data subscription ==="
fd -e "ts" -e "tsx" -e "js" -e "jsx" | xargs grep -l "useCurrentUser" | grep -i "hook\|service" | head -5

echo -e "\n=== Get first few matches of where useCurrentUser is used ==="
rg -n "useCurrentUser" --type-list | head -20

Repository: bigbluebutton/bigbluebutton

Length of output: 2738


🏁 Script executed:

#!/bin/bash
# Examine useCurrentUser hook and actions-bar parent component

echo "=== Read useCurrentUser hook definition ==="
cat -n bigbluebutton-html5/imports/ui/core/hooks/useCurrentUser.ts

echo -e "\n=== Look at actions-bar component to see where amIPresenter comes from ==="
head -50 bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx

echo -e "\n=== Search for where amIPresenter is defined in actions-bar ==="
grep -n "amIPresenter" bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx | head -20

Repository: bigbluebutton/bigbluebutton

Length of output: 4320


🏁 Script executed:

#!/bin/bash
# Find where amIPresenter comes from in the parent - look for ActionsBar container

echo "=== Search for ActionsBar container ==="
find bigbluebutton-html5/imports/ui/components/actions-bar -name "*.jsx" -o -name "*.tsx" | grep -i container

echo -e "\n=== Look at CURRENT_USER_SUBSCRIPTION to see what fields it includes ==="
rg -n "CURRENT_USER_SUBSCRIPTION" -A20

echo -e "\n=== Search for where amIPresenter is set as a prop in the app ==="
rg -n "amIPresenter=" | head -30

echo -e "\n=== Check if amIPresenter comes from current user subscription ==="
rg -n "presenter" bigbluebutton-html5/imports/ui/core/graphql/queries/ | grep -i subscription

Repository: bigbluebutton/bigbluebutton

Length of output: 7212


🏁 Script executed:

#!/bin/bash
# Check the complete CURRENT_USER_SUBSCRIPTION to see all fields

echo "=== Read complete currentUserSubscription.ts ==="
cat -n bigbluebutton-html5/imports/ui/core/graphql/queries/currentUserSubscription.ts

echo -e "\n=== Check ActionsBar container to see where amIPresenter prop comes from ==="
cat -n bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx | head -200

Repository: bigbluebutton/bigbluebutton

Length of output: 10986


🏁 Script executed:

#!/bin/bash
# Now let's verify if both props update atomically from the same subscription

echo "=== Check how createUseSubscription works ==="
fd -e "ts" -e "tsx" -e "js" -e "jsx" | xargs grep -l "createUseSubscription" | head -5

echo -e "\n=== Find createUseSubscription definition ==="
rg -n "createUseSubscription" | grep -i "export\|function\|const" | head -10

echo -e "\n=== Look for the actual implementation ==="
find bigbluebutton-html5 -name "*.ts" -o -name "*.tsx" | xargs grep -l "export.*createUseSubscription" 2>/dev/null | head -3

Repository: bigbluebutton/bigbluebutton

Length of output: 1920


🏁 Script executed:

#!/bin/bash
# Examine createUseSubscription implementation

echo "=== Read createUseSubscription implementation ==="
wc -l bigbluebutton-html5/imports/ui/core/hooks/createUseSubscription.ts

echo -e "\n=== Read first 100 lines ==="
head -100 bigbluebutton-html5/imports/ui/core/hooks/createUseSubscription.ts

echo -e "\n=== Read lines 100-200 ==="
sed -n '100,200p' bigbluebutton-html5/imports/ui/core/hooks/createUseSubscription.ts

echo -e "\n=== Most important: check how data is cached/memoized ==="
sed -n '200,252p' bigbluebutton-html5/imports/ui/core/hooks/createUseSubscription.ts

Repository: bigbluebutton/bigbluebutton

Length of output: 8900


🏁 Script executed:

#!/bin/bash
# Check React version and verify if there's explicit batching

echo "=== Check package.json for React version ==="
grep -i "react" bigbluebutton-html5/package.json | head -20

echo -e "\n=== Check if there's any unstable_batchedUpdates usage ==="
rg -n "unstable_batchedUpdates\|batchedUpdates" bigbluebutton-html5/ | head -10

echo -e "\n=== Verify both props truly come from same subscription by checking if useCurrentUser is called twice with different projections in the same component hierarchy ==="
grep -n "useCurrentUser" bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

grep -n "useCurrentUser" bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx

Repository: bigbluebutton/bigbluebutton

Length of output: 1237


🏁 Script executed:

#!/bin/bash
# Final verification: check if these props are passed together through component hierarchy

echo "=== Trace prop flow from ActionsBarContainer to MediaArea ==="
echo "Step 1: ActionsBarContainer passes amIPresenter to ActionsBar:"
grep -n "amIPresenter={amIPresenter}" bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx

echo -e "\nStep 2: ActionsBar receives it and passes to MediaAreaContainer:"
grep -n "amIPresenter=" bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx | head -5

echo -e "\nStep 3: MediaAreaContainer receives amIPresenter as prop:"
sed -n '22,32p' bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

echo -e "\nStep 4: MediaAreaContainer passes it to MediaArea:"
grep -n "amIPresenter={amIPresenter}" bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

Repository: bigbluebutton/bigbluebutton

Length of output: 697


🏁 Script executed:

#!/bin/bash
# Verify the actual data flow one more time to be absolutely certain

echo "=== Key insight: where does amIPresenter come from for MediaAreaContainer? ==="
echo "MediaAreaContainer receives amIPresenter as PROP from ActionsBar (line 24 in container.tsx)"
sed -n '22,32p' bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

echo -e "\n=== But MediaAreaContainer ALSO calls useCurrentUser independently ==="
sed -n '41,46p' bigbluebutton-html5/imports/ui/components/actions-bar/media-area/container.tsx

echo -e "\n=== This means: ==="
echo "1. amIPresenter in MediaAreaComponent comes from: ActionsBarContainer -> ActionsBar -> MediaAreaContainer (as prop)"
echo "2. isRequestingPresenter in MediaAreaComponent comes from: MediaAreaContainer's own useCurrentUser hook"
echo "3. They are INDEPENDENT STATE SOURCES despite coming from same GraphQL subscription"

echo -e "\n=== Trace amIPresenter source path ==="
echo "ActionsBarContainer (line 84-87: calls useCurrentUser)"
sed -n '84,87p' bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx

echo -e "\nActionsBarContainer -> passes amIPresenter to ActionsBar (line 162)"
sed -n '162p' bigbluebutton-html5/imports/ui/components/actions-bar/container.jsx

echo -e "\nActionsBar -> passes amIPresenter to MediaAreaContainer (line 241-242)"
sed -n '241,242p' bigbluebutton-html5/imports/ui/components/actions-bar/component.jsx

Repository: bigbluebutton/bigbluebutton

Length of output: 1559


The race condition concern is valid and requires fixing.

Both amIPresenter and isRequestingPresenter come from the same CURRENT_USER_SUBSCRIPTION, but they originate from separate hook instances in different containers:

  • amIPresenter: ActionsBarContainer's useCurrentUser() → passed via props through ActionsBar → MediaAreaContainer → MediaArea
  • isRequestingPresenter: MediaAreaContainer's own useCurrentUser() → MediaArea

This creates independent state sources. When the server sends an approval (presenter=true, requestedPresenter=false), React's batching may not synchronize these separate component state updates:

  1. ActionsBarContainer updates and re-renders with new amIPresenter
  2. MediaArea renders with stale amIPresenter while isRequestingPresenter changes
  3. Effect condition evaluates to true → false denial notification fires
  4. MediaAreaContainer updates moments later with corrected amIPresenter

Fix: Combine both fields in a single useCurrentUser() call within MediaAreaContainer, or pass both from the parent to ensure atomic updates.

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@lfzawacki
lfzawacki merged commit 47b1830 into bigbluebutton:v3.1.x-release Dec 16, 2025
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.

5 participants