Skip to content

fix: suppress join/leave notifications for locked viewers when hideUserList is active - #24924

Merged
antobinary merged 7 commits into
bigbluebutton:v3.0.x-developfrom
Tainan404:i-24888
Apr 21, 2026
Merged

antobinary merged 7 commits into
bigbluebutton:v3.0.x-developfrom
Tainan404:i-24888

Conversation

@Tainan404

Copy link
Copy Markdown
Member

What does this PR do?

Add a Filter for Locked Viewer not see joined/left users.

Closes Issue(s)

Closes #24888

Motivation

How to test

  • Join a mod
  • Apply the lock settings to hide viewers on user list
  • join a viewer
  • enable notification to receive notification of join/left viewers

  hideUserList is active

  When lockSettingsHideUserList=true, locked viewers were still receiving
  audio/push notifications for user join and leave events, leaking usernames
  via the notification stream which bypasses Hasura and is broadcast to all
  browser connections directly from Redis.

  Instead of broadcasting to all, iterate active users and send per-user
  notifications only to moderators and unlocked viewers.
@coderabbitai

coderabbitai Bot commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5d2ed321-a344-4373-af1d-38823322c4db

📥 Commits

Reviewing files that changed from the base of the PR and between 7616c94 and 44263db.

📒 Files selected for processing (1)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala

Walkthrough

The PR makes join and leave notification delivery conditional on the meeting permission hideUserList. For both user-join (HandlerHelpers.userJoinMeeting) and deferred user-leave expiration (MeetingActor.removeUsersWithExpiredUserLeftFlag) flows: when hideUserList is true and the subject is not a moderator, the code enumerates meeting users, filters out users who left and restricts recipients to unlocked users or moderators, then builds/sends a per-recipient NotifyUserInMeeting event and inserts a notification per recipient. When hideUserList is false or the subject is a moderator, the previous behavior remains: a single NotifyAllInMeeting event is broadcast and one notification is inserted.

Sequence Diagram(s)

sequenceDiagram
    participant MeetingActor
    participant HandlerHelpers
    participant Users2x
    participant OutGW
    participant NotificationDAO

    Note over MeetingActor,HandlerHelpers: user join or deferred-leave handling
    MeetingActor->>HandlerHelpers: handle join/leave request
    HandlerHelpers->>MeetingActor: determine liveMeeting & subject role
    alt hideUserList = true and subject not moderator
        HandlerHelpers->>Users2x: findAll(liveMeeting.users2x)
        Users2x-->>HandlerHelpers: user list
        loop per recipient (not left && (unlocked || moderator))
            HandlerHelpers->>OutGW: buildNotifyUserInMeetingEvtMsg -> send to recipient
            HandlerHelpers->>NotificationDAO: insert per-recipient notification
        end
    else
        HandlerHelpers->>OutGW: buildNotifyAllInMeetingEvtMsg -> broadcast
        HandlerHelpers->>NotificationDAO: insert single notification
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding notification suppression for locked viewers when hideUserList is active, directly addressing the core objective.
Description check ✅ Passed The description is related to the changeset, referencing the linked issue and providing test steps to verify the notification filtering behavior.
Linked Issues check ✅ Passed The PR successfully implements the core objective from issue #24888: preventing usernames from leaking to locked viewers via join/leave notifications when lockSettingsHideUserList is enabled, while preserving functionality for moderators and unlocked viewers.
Out of Scope Changes check ✅ Passed All changes are scoped to the notification filtering objective: backend logic in HandlerHelpers and MeetingActor for permission-gated notifications, frontend test attributes/helpers, and comprehensive regression tests validating the notification suppression behavior.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

Adjusts server-side join/leave notification emission to prevent locked viewers from receiving (and thus leaking) participant join/leave usernames when lockSettingsHideUserList=true, aligning notification behavior with the “hidden user list” lock setting.

Changes:

  • When hideUserList is enabled, replaces meeting-wide join/leave notifications with per-user notifications targeting only moderators and unlocked users.
  • Keeps existing broadcast (“notify all”) behavior when hideUserList is disabled.
  • Minor formatting/alignment adjustments in MeetingActor message handling cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala Changes leave notification emission to avoid notifying locked viewers when hideUserList is active.
akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala Changes join notification emission to avoid notifying locked viewers when hideUserList is active.

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

@antobinary antobinary added this to the Release 3.0 milestone Apr 16, 2026

@ramonlsouza ramonlsouza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. with these changes, a locked viewer will not receive moderators join/leave notifications... is it expected? (maybe we should only ignore if the notification is from a viewer)
  2. when hideUserList is active, the name being displayed in user left notification is incorrect (it is displaying the current user's name, not the name of the user that left)
Screencast.from.2026-04-16.10-03-46.mp4

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.


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

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

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

1157-1180: Minor: inconsistent name interpolation between branches.

Line 1157 extracts val leaverName = u.name and uses it directly on line 1168, but the else branch on line 1180 re-interpolates as s"${u.name}". Use u.name (or leaverName) in both places for consistency and to drop the unnecessary s"" wrapping.

🧹 Proposed tidy-up
-            Map("userName" -> s"${u.name}")
+            Map("userName" -> u.name)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala`
around lines 1157 - 1180, The code mixes direct use of u.name and an unnecessary
string interpolation s"${u.name}" when building the leave notification; make
them consistent by using the extracted val leaverName (or u.name) in both
branches — update the buildNotifyAllInMeetingEvtMsg call to pass Map("userName"
-> leaverName) (or Map("userName" -> u.name)) so it matches the foreach branch
that uses leaverName and removes the redundant s"" interpolation.

1156-1184: Extract duplicated notification-gating logic into a shared helper.

This branching block is essentially identical to the newly added join-notification block in HandlerHelpers.scala (lines 104–131), differing only in the messageId/user-name source. Duplicating the hideUserList + !moderator + !left && (!locked || moderator) filter in two places invites drift (e.g., someone later fixing the filter in only one copy). A small helper in HandlerHelpers (or a new object) taking (liveMeeting, subjectUser, messageId, description) and performing the per-recipient vs. broadcast decision would keep both flows in sync.

♻️ Sketch of a shared helper
// In HandlerHelpers (or a dedicated object):
def sendUserJoinLeaveNotification(
    outGW: OutMsgRouter,
    liveMeeting: LiveMeeting,
    subject: UserState,
    messageId: String,
    messageDescription: String
): Unit = {
  val meetingId = liveMeeting.props.meetingProp.intId
  val values = Map("userName" -> subject.name)
  if (MeetingStatus2x.getPermissions(liveMeeting.status).hideUserList
      && subject.role != Roles.MODERATOR_ROLE) {
    Users2x.findAll(liveMeeting.users2x)
      .filter(r => !r.userLeftFlag.left && (!r.locked || r.role == Roles.MODERATOR_ROLE))
      .foreach { r =>
        val evt = MsgBuilder.buildNotifyUserInMeetingEvtMsg(
          r.intId, meetingId, "info", "user", messageId, messageDescription, values)
        outGW.send(evt)
        NotificationDAO.insert(evt)
      }
  } else {
    val evt = MsgBuilder.buildNotifyAllInMeetingEvtMsg(
      meetingId, "info", "user", messageId, messageDescription, values)
    outGW.send(evt)
    NotificationDAO.insert(evt)
  }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala`
around lines 1156 - 1184, The leave-notification branch in MeetingActor
duplicates the same hideUserList + role + recipient filter logic found in
HandlerHelpers.scala for joins; extract that logic into a shared helper (e.g.,
HandlerHelpers.sendUserJoinLeaveNotification) that accepts (outGW: OutMsgRouter,
liveMeeting: LiveMeeting, subject: UserState, messageId: String,
messageDescription: String) and performs the per-recipient vs broadcast
decision, builds the MsgBuilder event(s) and calls outGW.send +
NotificationDAO.insert; replace the duplicated blocks in MeetingActor (the
current leave block) and the join block in HandlerHelpers (lines ~104–131) with
calls to this helper, passing the appropriate messageId and description and the
subject user to avoid drift.
bigbluebutton-tests/playwright/user/lockViewers.ts (2)

535-540: Nit: UPLOAD_PDF_WAIT_TIME is a semantically misleading timeout for leave-notification waits.

UPLOAD_PDF_WAIT_TIME is defined under "MEDIA CONNECTION TIMEOUTS" (for PDF uploads, 30s). Reusing it here just because the numeric value matches the ~20s userLeftFlag expiry + audit tick makes these tests harder to understand and creates a bogus coupling: if someone tunes PDF upload timeouts they’ll unintentionally affect notification tests. Consider introducing a dedicated constant (e.g., USER_LEFT_NOTIFICATION_WAIT_TIME) or just using a named local with a comment explaining the 10s flag expiry + 10s audit interval.

Also applies to: 671-683

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

In `@bigbluebutton-tests/playwright/user/lockViewers.ts` around lines 535 - 540,
Replace the semantically misleading UPLOAD_PDF_WAIT_TIME used in
leave-notification assertions with a dedicated timeout constant or named local
to reflect the user-left notification semantics: add
USER_LEFT_NOTIFICATION_WAIT_TIME (or a local like userLeftNotificationWait =
20000) and use it in calls such as this.modPage.hasText(e.smallToastMsg,
`${leavingUsername} left the session`, ..., USER_LEFT_NOTIFICATION_WAIT_TIME);
update all other occurrences mentioned (around the other block at 671-683) so
the tests no longer reuse the MEDIA CONNECTION timeout and include a brief
comment explaining the value (e.g., 10s userLeftFlag expiry + 10s audit
interval).

474-479: Replace hardcoded English notification strings with locale-aware constants or a shared pattern.

These tests hardcode "${username} joined the session" and "${username} left the session" strings, which are sourced from i18n (app.notification.userJoinPushAlert / userLeavePushAlert). If tests run under a non-English locale or if the source string changes, all these assertions break.

The codebase establishes a pattern of using toast constants from elements.ts (e.g., e.attendeeJoinedToast used in notifications/notifications.ts). While an attendeeJoinedToast constant exists, it uses static text without the username. Consider either:

  1. Creating new constants for user join/leave notifications with dynamic username templating
  2. Adopting the checkNotificationText helper pattern from notifications/util.ts
  3. Pulling the expected strings from a locale-aware source at test runtime

Occurs at lines 476, 537, 607, 614, 673, 680, 735, 742, 790, 797 (shown in snippet above; also applies to lines 535–540, 605–617, 671–683, 733–745, 788–800).

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

In `@bigbluebutton-tests/playwright/user/lockViewers.ts` around lines 474 - 479,
Replace hardcoded English join/leave notification assertions with a locale-aware
approach: stop using `${this.userPage2.username} joined the session` in hasText
calls and instead use the existing toast constant or helper pattern—either add
templated constants like e.userJoinToast and e.userLeaveToast that accept a
username, or call the notifications/util.ts helper checkNotificationText (or
equivalent) to build/verify the localized message at runtime; update calls that
reference e.smallToastMsg and the hasText assertion (e.g., in lockViewers.ts
where hasText is invoked) to use the new templated constants or the
checkNotificationText helper so tests remain locale-independent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala`:
- Around line 1156-1172: The current per-recipient loop inside the
removeUsersWithExpiredUserLeftFlag audit (using Users2x.findAll and
building/sending NotifyUserInMeetingEvtMsg per recipient) fans out linearly and
should be replaced with a single broadcast to avoid O(N^2) outbound work; change
the code that builds/sends per-recipient notifications (the loop that calls
MsgBuilder.buildNotifyUserInMeetingEvtMsg, outGW.send and
NotificationDAO.insert) to create one notification event and broadcast it once
to the meeting (use the appropriate broadcast/sendAll method or build a
meeting-scoped NotifyUserInMeetingEvtMsg), and similarly avoid calling
NotificationDAO.insert per recipient (either insert once or skip if no-op) so
the MeetingActor thread does a single send instead of N sends.

---

Nitpick comments:
In
`@akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala`:
- Around line 1157-1180: The code mixes direct use of u.name and an unnecessary
string interpolation s"${u.name}" when building the leave notification; make
them consistent by using the extracted val leaverName (or u.name) in both
branches — update the buildNotifyAllInMeetingEvtMsg call to pass Map("userName"
-> leaverName) (or Map("userName" -> u.name)) so it matches the foreach branch
that uses leaverName and removes the redundant s"" interpolation.
- Around line 1156-1184: The leave-notification branch in MeetingActor
duplicates the same hideUserList + role + recipient filter logic found in
HandlerHelpers.scala for joins; extract that logic into a shared helper (e.g.,
HandlerHelpers.sendUserJoinLeaveNotification) that accepts (outGW: OutMsgRouter,
liveMeeting: LiveMeeting, subject: UserState, messageId: String,
messageDescription: String) and performs the per-recipient vs broadcast
decision, builds the MsgBuilder event(s) and calls outGW.send +
NotificationDAO.insert; replace the duplicated blocks in MeetingActor (the
current leave block) and the join block in HandlerHelpers (lines ~104–131) with
calls to this helper, passing the appropriate messageId and description and the
subject user to avoid drift.

In `@bigbluebutton-tests/playwright/user/lockViewers.ts`:
- Around line 535-540: Replace the semantically misleading UPLOAD_PDF_WAIT_TIME
used in leave-notification assertions with a dedicated timeout constant or named
local to reflect the user-left notification semantics: add
USER_LEFT_NOTIFICATION_WAIT_TIME (or a local like userLeftNotificationWait =
20000) and use it in calls such as this.modPage.hasText(e.smallToastMsg,
`${leavingUsername} left the session`, ..., USER_LEFT_NOTIFICATION_WAIT_TIME);
update all other occurrences mentioned (around the other block at 671-683) so
the tests no longer reuse the MEDIA CONNECTION timeout and include a brief
comment explaining the value (e.g., 10s userLeftFlag expiry + 10s audit
interval).
- Around line 474-479: Replace hardcoded English join/leave notification
assertions with a locale-aware approach: stop using `${this.userPage2.username}
joined the session` in hasText calls and instead use the existing toast constant
or helper pattern—either add templated constants like e.userJoinToast and
e.userLeaveToast that accept a username, or call the notifications/util.ts
helper checkNotificationText (or equivalent) to build/verify the localized
message at runtime; update calls that reference e.smallToastMsg and the hasText
assertion (e.g., in lockViewers.ts where hasText is invoked) to use the new
templated constants or the checkNotificationText helper so tests remain
locale-independent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f495d9e4-a0b8-483a-a278-56fed96381e6

📥 Commits

Reviewing files that changed from the base of the PR and between e022848 and 677ab0e.

📒 Files selected for processing (4)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • bigbluebutton-tests/playwright/user/lockViewers.ts
  • bigbluebutton-tests/playwright/user/user.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • bigbluebutton-tests/playwright/user/user.spec.ts

@Tainan404
Tainan404 marked this pull request as draft April 17, 2026 17:06
@Tainan404

Tainan404 commented Apr 17, 2026 •

Copy link
Copy Markdown
Member Author

I draft it to read and consider AI comments, please don't merge

- Replace UPLOAD_PDF_WAIT_TIME with USER_LEFT_NOTIFICATION_WAIT_TIME in
  leave-notification assertions (semantic correctness)
- Fix assertion order in join tests: positive (mod sees toast) before
  negative (locked viewer doesn't), preventing false positives on slow CI
- Replace PR# reference with issue# in test comment (stable reference)
- Remove redundant s"${x.name}" string interpolation in HandlerHelpers
  and MeetingActor (s"" wrapping a String is a no-op)
@Tainan404
Tainan404 marked this pull request as ready for review April 17, 2026 19:04
@Tainan404

Copy link
Copy Markdown
Member Author

Relevants Ai suggestions applied, ready to review and merge

@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.

🧹 Nitpick comments (1)
bigbluebutton-tests/playwright/user/lockViewers.ts (1)

432-482: Test correctness depends on lockOnJoin being implicitly enabled by the lockUserList toggle.

The fix's server-side filter is !recipient.locked || recipient.role == MODERATOR_ROLE, so the "locked viewer must not receive a notification" assertion on line 477 only actually validates the fix if Viewer1 joined with locked=true. That requires lockOnJoin=true at the moment of join — but the test only toggles e.lockUserList in the UI (line 436). The doc comment on line 426 asserts "(hideUserList=true, lockOnJoin=true)" but this is only true if the lock-viewers modal cascades to lockOnJoin or the env default already has it on.

If lockOnJoin were ever changed to default-off (or the cascade behavior changes), these tests would silently pass by accident (Viewer1 would be unlocked and legitimately not affected by suppression, but that's not what's under test). Worth either explicitly asserting Viewer1's locked state in the UI before the act phase, or explicitly toggling lockOnJoin in the modal to pin the precondition.

Same caveat applies to hideUserListSuppressesLeaveNotification, hideUserListJoinNotificationVisibleForUnlockedAndModOnly, and hideUserListLeaveNotificationVisibleForUnlockedAndModOnly.

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

In `@bigbluebutton-tests/playwright/user/lockViewers.ts` around lines 432 - 482,
The test relies on lockOnJoin being enabled but only clicks e.lockUserList;
update hideUserListSuppressesJoinNotification to either (A) explicitly enable
the lockOnJoin option in the lock-viewers modal (use openLockViewers and click
the lockOnJoin control) before applying locks, or (B) after initUserPage assert
that Viewer1 is locked (check the UI/state for locked=true) and fail if not;
apply the same explicit toggle or assertion pattern to the sibling tests
hideUserListSuppressesLeaveNotification,
hideUserListJoinNotificationVisibleForUnlockedAndModOnly, and
hideUserListLeaveNotificationVisibleForUnlockedAndModOnly so the precondition is
pinned.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@bigbluebutton-tests/playwright/user/lockViewers.ts`:
- Around line 432-482: The test relies on lockOnJoin being enabled but only
clicks e.lockUserList; update hideUserListSuppressesJoinNotification to either
(A) explicitly enable the lockOnJoin option in the lock-viewers modal (use
openLockViewers and click the lockOnJoin control) before applying locks, or (B)
after initUserPage assert that Viewer1 is locked (check the UI/state for
locked=true) and fail if not; apply the same explicit toggle or assertion
pattern to the sibling tests hideUserListSuppressesLeaveNotification,
hideUserListJoinNotificationVisibleForUnlockedAndModOnly, and
hideUserListLeaveNotificationVisibleForUnlockedAndModOnly so the precondition is
pinned.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 81d8bc65-6493-4791-9234-61aef698ebfb

📥 Commits

Reviewing files that changed from the base of the PR and between 677ab0e and 7616c94.

📒 Files selected for processing (4)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/HandlerHelpers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • bigbluebutton-tests/playwright/core/constants.ts
  • bigbluebutton-tests/playwright/user/lockViewers.ts
✅ Files skipped from review due to trivial changes (1)
  • bigbluebutton-tests/playwright/core/constants.ts

leaverName was declared inside the if-branch, making it unavailable
in the else-branch and causing a compilation error.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
13.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary merged commit 88ed5e5 into bigbluebutton:v3.0.x-develop Apr 21, 2026
32 of 33 checks passed
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.

Usernames leaking via notifications when lockSettingsHideUserList=true

4 participants