Skip to content

feat(shared-notes): markdown export, init-from-markdown, and import modal - #25373

Merged
antobinary merged 14 commits into
bigbluebutton:v3.0.x-developfrom
imdt-claudiop:feat/shared-notes-markdown
Jul 16, 2026
Merged

antobinary merged 14 commits into
bigbluebutton:v3.0.x-developfrom
imdt-claudiop:feat/shared-notes-markdown

Conversation

@imdt-claudiop

@imdt-claudiop imdt-claudiop commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds three Markdown capabilities to BlockNote Shared Notes:

  1. Export as Markdown - a new kebab item next to "Export as PDF" that downloads the notes as a .md file. The shared-notes server already served /export/md; this only wires the client menu item.
  2. Init from Markdown on create - two new create parameters, sharedNotesInitialContentMarkdown (raw markdown string) and sharedNotesInitialContentMarkdownUrl (fetched server side), mirroring the existing sharedNotesInitialContentJson pipeline. The markdown travels as a raw string through bbb-web, akka and redis, and is converted to BlockNote blocks on the shared-notes server (the only tier where BlockNote runs) before seeding an empty document.
  3. Import from Markdown - a presenter-only kebab item opens a modal with two input paths:
    • a drag-and-drop / file-browse dropzone that reads a .md/.markdown file (primary path), and
    • the original textarea for pasting markdown (secondary path, always visible).
      On submit the client parses the markdown and writes it into the document, which propagates to every connected client through the shared Yjs document. An Append | Replace radio (default Append) controls whether the imported blocks are inserted after the existing content or overwrite it; the previous two-step "this will replace" confirmation alert is replaced by this explicit, non-destructive-by-default selector.
  4. Configurable Markdown menu items - the Import from Markdown and Export notes as Markdown kebab items are gated by two new settings under public.sharedNotes: importMarkdownEnabled and exportMarkdownEnabled, both defaulting to false. The default is off so a minor-version update of BBB 3.0 does not surface a new shared-notes menu button unless a deployment opts in; set either to true to enable the corresponding affordance.
  5. Menu ordering - Import from Markdown is now the first item in the shared-notes kebab menu (above Convert notes to presentation), reflecting that import is the most likely entry action.

Why

Shared Notes could already round-trip to PDF/HTML/TXT/JSON but had no Markdown in or out. Markdown is the natural interchange format for notes: it lets an integrator pre-seed a room from a template and lets users paste external markdown into a live session. File upload makes the interchange path concrete (drag a .md in, or paste), and the Append/Replace choice removes modal-on-modal friction while keeping a safe default.

How it was validated

BlockNote 0.51 (@blocknote/server-util and @blocknote/core) exposes tryParseMarkdownToBlocks and editor.replaceBlocks, confirmed in the real node_modules before implementation. Built and deployed from source on a 3.0 environment and covered by new Playwright tests (all green):

  • Export as Markdown downloads a .md file whose content matches the editor.
  • A room created with sharedNotesInitialContentMarkdown renders the seeded heading and list.
  • The import modal writes the parsed markdown into the document via Append (default) or Replace, and both modes propagate to a second connected user.
  • A dropped/browsed .md file populates the modal and imports correctly; wrong-type, too-large, and empty files are rejected with an inline error and do not clear text the user typed.
  • Import and Export Markdown kebab items are hidden by default and only appear when their respective setting (importMarkdownEnabled / exportMarkdownEnabled) is set to true.
  • A markdown parse failure in the import modal shows an inline error and keeps the modal open for retry, instead of freezing silently.

Evidence

Each clip below demonstrates one capability against a live from-source BBB 3.0 room (created with sharedNotesEditor=blockNote). Per-feature timestamps are not needed: each clip is a single short demonstration of that feature end-to-end.

Preview animated below - click a GIF to open the higher-quality MP4 (with controls):

Feature 1 - Export as Markdown (editor with content, kebab menu, .md download asserted by the Playwright test):

Export as Markdown

Feature 2a - Init from Markdown (room created with sharedNotesInitialContentMarkdown; notes open with the seeded heading + list):

Init from Markdown

Feature 2b - Import from Markdown (moderator) (modal submitted; notes replaced with the imported content):

Import from Markdown - moderator

Feature 2b - Import propagates to a second user (attendee sees the same imported content via the shared Yjs document):

Import propagates to attendee

Feature 3 - Import modal UX: file upload + Append/Replace (the modal now opens with a dropzone as the primary path, the textarea as an optional secondary path, and an Append | Replace radio defaulting to Append; the clip shows a .md file being uploaded, the file chip, the populated textarea, Import rendering the content in the editor, then a second import in Replace mode overwriting the document):

Import modal: dropzone + Append/Replace radio + upload flow

Note: the Append/Replace selector is covered by the Playwright suite (importFromMarkdownAppend, importFromMarkdownReplace). The file-upload validation states (wrong-type, too-large, empty) are covered by importFromMarkdownUploadFile, importFromMarkdownUploadWrongType, and importFromMarkdownUploadEmptyFile.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 855fa06a-24ec-4728-bd13-8fa11a44ce5b

📥 Commits

Reviewing files that changed from the base of the PR and between 4520278 and bd7b116.

📒 Files selected for processing (1)
  • bbb-shared-notes-server/src/redis/service/pushInitialContent.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • bbb-shared-notes-server/src/redis/service/pushInitialContent.ts

Walkthrough

This PR adds Markdown-based shared-notes initialization through create-meeting parameters, secure URL fetching, meeting models, gateway messages, and shared-notes server seeding. It adds BlockNote Markdown import and export actions, an import modal with append/replace modes and upload validation, feature flags, localization, Playwright coverage, runtime configuration, and API documentation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Suggested reviewers: GuiLeme, ramonlsouza, antobinary

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MeetingService
  participant BbbWebApiGWApp
  participant MeetingActor
  participant SharedNotesServer
  Client->>MeetingService: create meeting with Markdown parameters
  MeetingService->>BbbWebApiGWApp: pass resolved Markdown content
  BbbWebApiGWApp->>MeetingActor: publish shared-notes initialization
  MeetingActor->>SharedNotesServer: send JSON and Markdown content
  SharedNotesServer->>SharedNotesServer: seed JSON or fallback to Markdown
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.05% 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 matches the main change: Markdown export, Markdown initialization, and the new import modal.
Description check ✅ Passed The description is detailed and directly describes the same Markdown export, init, import, and config changes in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@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 (1)
bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.ts (1)

1-100: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing test coverage for the cancel path.

notesImportMarkdownCancel is added in elements.ts but never exercised here — only the confirm/replace flow is covered. Consider adding a method (and corresponding spec test) that fills the textarea, clicks cancel on the confirmation warning, and asserts the original content is preserved.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.ts` around
lines 1 - 100, Add coverage for the markdown import cancel path in
MarkdownSharedNotes: create a new method that opens the import flow, fills
notesImportMarkdownTextarea, triggers the confirmation warning, clicks
notesImportMarkdownCancel instead of confirming, and verifies the original
editor content remains unchanged. Then wire this into a corresponding spec test
so the non-destructive cancel behavior is exercised alongside the existing
importFromMarkdownReplacesWithConfirmation flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java`:
- Around line 450-471: The shared-notes markdown fetch in
requestSharedNotesInitialContentMarkdownFromUrl can block meeting creation
because it uses URL.openStream() with no timeout or response-size limit while
createMeeting() holds the monitor. Update this flow to use SecureUrlDownloader
like the other URL-based parameter loaders, or add explicit connect/read
timeouts and a max payload cap before reading the content. Keep the existing
redirectFollower.followRedirect and logging, but ensure the download path in
MeetingService is bounded and non-blocking.

---

Nitpick comments:
In `@bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.ts`:
- Around line 1-100: Add coverage for the markdown import cancel path in
MarkdownSharedNotes: create a new method that opens the import flow, fills
notesImportMarkdownTextarea, triggers the confirmation warning, clicks
notesImportMarkdownCancel instead of confirming, and verifies the original
editor content remains unchanged. Then wire this into a corresponding spec test
so the non-destructive cancel behavior is exercised alongside the existing
importFromMarkdownReplacesWithConfirmation flow.
🪄 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: 83cee435-3d18-40e0-89d9-b00e3ae01dd8

📥 Commits

Reviewing files that changed from the base of the PR and between 9cb82f8 and 0427d9c.

📒 Files selected for processing (22)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/pads/PadslHdlrHelpers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Meeting2x.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PadsMsgs.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-shared-notes-server/src/redis/handler.ts
  • bbb-shared-notes-server/src/redis/service/pushInitialContent.ts
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/import-context.tsx
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/component.tsx
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/styles.ts
  • bigbluebutton-html5/imports/ui/components/notes/component.tsx
  • bigbluebutton-html5/imports/ui/components/notes/notes-dropdown/component.tsx
  • bigbluebutton-html5/public/locales/en.json
  • bigbluebutton-tests/playwright/core/elements.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.spec.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.ts

@imdt-claudiop
imdt-claudiop marked this pull request as draft July 6, 2026 12:52
@antobinary antobinary added this to the Release 3.0 milestone Jul 6, 2026
…odal

Add three Markdown capabilities to BlockNote shared notes:

- Export as Markdown: new kebab item mirroring Export as PDF, hitting the
  existing /export/md document endpoint.
- Init from Markdown on create: new sharedNotesInitialContentMarkdown and
  sharedNotesInitialContentMarkdownUrl create params, carried as a raw string
  through the web/akka pipeline and converted to blocks on the shared-notes
  server (where BlockNote is available) before seeding the empty document.
- Import from Markdown: presenter-only kebab item opens a modal with a textarea
  that replaces the current notes client-side via editor.replaceBlocks, which
  propagates to every client through the shared Yjs document. Replacing a
  non-empty document requires an explicit confirmation.
…port

Playwright coverage for the three markdown features, run against a live
from-source BlockNote shared-notes environment:

- export downloads a .md file whose content matches the editor;
- a room created with sharedNotesInitialContentMarkdown renders the seeded
  heading and list;
- the import modal replaces a non-empty document only after confirmation;
- an import propagates to a second connected user through the shared document.
@imdt-claudiop
imdt-claudiop force-pushed the feat/shared-notes-markdown branch from 0427d9c to d7f769d Compare July 7, 2026 03:39
@imdt-claudiop

Copy link
Copy Markdown
Contributor Author

Update based on initial review feedback:

Precedence changed: BlockNote JSON now takes precedence; Markdown is the fallback (used when JSON is absent, empty, or fails to convert). Partial writes from a failed JSON seed are cleaned before falling through.

Markdown via POST payload: sharedNotesInitialContentMarkdown can now also be sent in the POST body via an xml module, mirroring the JSON variant. Resolution order within Markdown: URL > create parameter > POST module.

Lint + docs: fixed the react/jsx-indent error in notes/component.tsx; documented the three Markdown parameters (inline, URL, POST module) and the precedence in docs/docs/development/api.md.

Tests: 3 new cases cover the JSON-wins precedence, the invalid-JSON-falls-back-to-Markdown path, and the POST-payload seeding. Existing tests still pass (8/8 green against a from-source 3.0 environment).

Route both shared-notes initial-content URL fetches (the pre-existing JSON
path and the new markdown path) through the same DNS-pinned fetch already
used by plugin, presentation and callback URLs: followRedirectSecure plus
SecureUrlDownloader. SharedNotesRedirectValidatorService now extends
BaseUrlRedirectValidator, so it applies the shared protocol allowlist,
blocked/local host rules and address-resolution checks, and the fetch is
capped by maxSharedNotesInitialContentUrlPayloadSize.

Both paths now go through one small fetchUrlContent helper instead of an
ad-hoc URL.openStream() reader. Shared notes was the only caller of the
non-secure followRedirect, so it is removed, leaving followRedirectSecure
as the single fetch entry point.

Docs: add the sharedNotesInitialContentMarkdown and
sharedNotesInitialContentMarkdownUrl create params to the API table, and
de-indent the CDATA markdown example so it pastes at the left margin.

Also drop dead try/catch blocks around plain map lookups introduced with
the markdown params in ParamsProcessorUtil.
@imdt-claudiop
imdt-claudiop force-pushed the feat/shared-notes-markdown branch from cddb96f to c7caec6 Compare July 7, 2026 05:45
@imdt-claudiop

Copy link
Copy Markdown
Contributor Author

Further hardening pass:

  • Both shared-notes initial-content URL fetches (the existing sharedNotesInitialContentJsonUrl and the new sharedNotesInitialContentMarkdownUrl) now go through the same DNS-pinned, validated path already used by plugins/presentation/callbacks (followRedirectSecure + secureUrlDownloader.downloadToString), with the shared-notes redirect validator extending BaseUrlRedirectValidator (protocol allowlist, blocked/local host rules, publicly-routable check).
  • Added a payload-size cap for the fetched URL content.
  • Extracted a shared fetchUrlContent helper so the JSON and Markdown paths no longer duplicate the fetch logic.
  • Documented the two new Markdown parameters in the canonical create.tsx parameter table, and fixed the indentation of the POST-module XML example in api.md.

Validated end-to-end against a from-source 3.0 environment: build clean, 8/8 Playwright tests green, and the URL validator now rejects link-local/private addresses at validation time (no internal connection attempted) while still fetching legitimate URLs.

@antobinary antobinary mentioned this pull request Jul 7, 2026
10 tasks done
@TiagoJacobs
TiagoJacobs self-requested a review July 7, 2026 15:06
The "Import from Markdown" dialog previously only accepted content pasted
into a textarea. This adds a file upload path as the primary way to bring in
notes, while keeping the textarea as an optional secondary path so nothing
that worked before changes.

Layout is stacked and compact: a drag-and-drop zone on top, an "or paste it
below" divider, then the existing textarea. Both feed the same markdown state,
so the parse/replace pipeline and the non-empty replace confirmation are
untouched.

The dropzone reuses the same react-dropzone component the presentation uploader
relies on. Files are validated by extension (.md/.markdown), capped at 1MB, and
read with FileReader. UX states are covered: idle, drag-over, file-loaded chip
(name/size/remove), wrong-type and read-error alerts, and an empty-file notice
that keeps import disabled. Errors and warnings use role=alert.

Adds Playwright coverage for uploading a valid file, rejecting a wrong type,
and disabling import for an empty file, alongside the existing paste tests.
Importing Markdown into the shared notes previously popped a second
confirmation ("This will replace the current notes. Continue?") whenever
the document was not empty. That is an extra click and only ever offered
one outcome: overwrite.

Replace it with an explicit Append/Replace radio inside the modal,
defaulting to Append so an import never silently destroys existing notes:

- Append (default): the parsed blocks are inserted after the current
  content via editor.insertBlocks.
- Replace: the whole document is overwritten via editor.replaceBlocks
  (the previous behaviour), now without a separate confirmation step.

The Import button stays enabled as long as the Markdown is non-empty.

Updates the i18n keys (drops importModal.replaceWarning, adds the
importMode.* strings) and the Playwright coverage: the old
confirmation test becomes separate Append and Replace tests.
The Markdown import modal wrapped react-dropzone@7 through styled-components,
which tripped three tsc errors and one eslint error, all type-level (runtime
was already correct):

- accept expects a single string, not string[]. Added ACCEPTED_EXTENSIONS_ATTR
  (comma-joined) for the picker hint; the array stays the source of truth for
  the extension check in loadFile.
- data-test is a valid data-* DOM attribute but not in the typed
  InputHTMLAttributes, so it is passed via an object spread instead of a cast,
  keeping the hook the Playwright test relies on.
- styled(Dropzone) merges the div ReactNode children with dropzone render-prop
  children into an intersection that excludes functions, so the render callback
  is passed through React.ReactNode.
- Extracted the render callback to a typed const (DropzoneRenderFunction) with
  the isDragActive destructure moved into the body, clearing the
  react/no-unused-prop-types false positive on the inline param type.
…mport/export configurable

Move "Import from Markdown" to the top of the shared notes options menu so it
is the first action presenters see.

Add two client settings under public.sharedNotes, both enabled by default:
- importMarkdownEnabled: toggles the "Import from Markdown" menu item
- exportMarkdownEnabled: toggles the "Export notes as Markdown" menu item

When both are disabled the menu keeps only Convert, Export as PDF and Pin.
The settings importMarkdownEnabled and exportMarkdownEnabled were added to
settings.yml and read in the notes dropdown component, but the SharedNotes
TypeScript interface was not updated, breaking ts-code-compilation. Add both
properties to the interface and provide their defaults in the initial values
so the required fields are satisfied.
…pload

feat(shared-notes): file upload and Append/Replace mode in the Markdown import modal
Add a Playwright case that opens the Markdown import modal, stages some
markdown, then cancels: the modal closes and neither the staged markdown
nor a mode change reaches the editor, so the existing document is left
untouched. Introduces the notesImportMarkdownModal selector so the close
can be asserted directly.
@TiagoJacobs

Copy link
Copy Markdown
Member

hello @imdt-claudiop

Configurable Markdown menu items - the Import from Markdown and Export notes as Markdown kebab items are gated by two new settings under public.sharedNotes: importMarkdownEnabled (default true) and exportMarkdownEnabled (default true), so deployments that do not want the Markdown affordances can turn them off.

as this is targeting BBB 3.0, please make these settings default=fase, so we don't surprise the users with a new button in a minor version update

@imdt-claudiop

imdt-claudiop commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Got it, Tiago. Makes total sense: switching the defaults of importMarkdownEnabled and exportMarkdownEnabled to false avoids surprising users with a new button in a minor version update. I will locate where the defaults live (settings template plus the client/server read points), adjust both, and update the PR.

@imdt-claudiop

imdt-claudiop commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor Author

Working on the defaults change (importMarkdownEnabled and exportMarkdownEnabled -> false): mapping all declaration sites (settings template, client schema, test fixtures) and applying it. I will follow up with the diff and update the PR.

@imdt-claudiop

imdt-claudiop commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor Author

On it now: mapping the declaration sites of importMarkdownEnabled and exportMarkdownEnabled (settings template, client schema, test fixtures) and switching the defaults to false. The PR tests that rely on these buttons being visible will set the settings explicitly in their setup. I will report back here once the diff is ready and the PR is updated.

@imdt-claudiop

Copy link
Copy Markdown
Contributor Author

Defaults flipped to false in both declaration sites (settings.yml and the client fallback in meetingClientSettings.ts). The read/guard sites in notes-dropdown/component.tsx are untouched, and there are no server-side defaults (these are client-only settings). Tests that open the Markdown menu now enable the two flags on the client before opening shared notes (client-only settings, no create-call parameter); the four seed-only scenarios are unaffected. Running a peer review on the diff, then I push and update the PR.

Per review feedback on PR 25373, importMarkdownEnabled and
exportMarkdownEnabled now default to false so a minor-version update
of BBB 3.0 does not surface a new shared-notes menu button. The flags
are client-only (no server default); the read/guard sites in
notes-dropdown are unchanged.

Tests that exercise the Markdown menu enable both flags on the client
before the notes panel mounts (the menu bakes its items at render time);
seed-only scenarios are unaffected.
@imdt-claudiop

Copy link
Copy Markdown
Contributor Author

Done - flipped both defaults to false (commit 5afcf65).

What changed:

  • importMarkdownEnabled and exportMarkdownEnabled now default to false in the two declaration sites: bigbluebutton-html5/private/config/settings.yml and the client fallback in meetingClientSettings.ts. The menu items stay off by default on BBB 3.0, so a minor update does not add a new button.
  • These are client-only settings (no server-side default); the read/guard sites in notes-dropdown/component.tsx are unchanged and keep reading whatever is configured.
  • Playwright scenarios that open the Markdown menu now enable both flags on the client before the notes panel mounts (the menu bakes its items at render time). The four seed-only scenarios are unaffected. No tests deleted; coverage preserved.

Reviewed the diff independently (only declaration sites touched, helper timing correct, scenario selection exact, override is self-contained and network-free). Deployments that want the Markdown affordances turn the two settings on explicitly.

@Tainan404
Tainan404 marked this pull request as ready for review July 9, 2026 16:58

@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 (4)
bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java (1)

415-430: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Hardcoded 6000 ms timeout — consider making it configurable.

The connect/read timeout is hardcoded here (twice), while the payload cap is already injectable via setMaxSharedNotesInitialContentUrlPayloadSize. Sibling fetch paths (plugin manifests, client-settings override) use configurable timeouts. Since this runs inside synchronized createMeeting(), an operator may want to tune it. Extracting a maxSharedNotesInitialContentUrlResponseTimeout field would keep this consistent with the other URL loaders.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java`
around lines 415 - 430, The URL fetch logic in fetchUrlContent hardcodes the
6000 ms timeout in both redirect resolution and download, so make this value
configurable like maxSharedNotesInitialContentUrlPayloadSize. Add a dedicated
timeout field (for example, maxSharedNotesInitialContentUrlResponseTimeout) with
a setter, then use that field in redirectFollower.followRedirectSecure and
secureUrlDownloader.downloadToString so MeetingService stays consistent with the
other URL loaders.
bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/component.tsx (1)

157-171: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider Blob#text() over FileReader#readAsText.

SonarCloud recommends the modern Blob#text() API which returns a promise and avoids the callback-based FileReader boilerplate. This is optional since the current code works correctly.

♻️ Optional refactor using Blob.text()
-    const reader = new FileReader();
-    reader.onerror = () => {
-      setError('readFailed');
-      clearFile();
-    };
-    reader.onload = () => {
-      const text = typeof reader.result === 'string' ? reader.result : '';
-      setFileName(file.name);
-      setFileSize(file.size);
-      setMarkdown(text);
-      setError(text.trim().length === 0 ? 'empty' : null);
-    };
-    reader.readAsText(file);
+    try {
+      const text = await file.text();
+      setFileName(file.name);
+      setFileSize(file.size);
+      setMarkdown(text);
+      setError(text.trim().length === 0 ? 'empty' : null);
+    } catch {
+      setError('readFailed');
+      clearFile();
+    }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/component.tsx`
around lines 157 - 171, The markdown import flow still uses callback-based
FileReader#readAsText in the file-loading logic, and this should be refactored
to the modern Blob#text() promise API. Update the file handling in the markdown
import modal component (the reader setup inside the import path) to await
file.text(), then keep the existing state updates for setFileName, setFileSize,
setMarkdown, and setError, while preserving the current error handling behavior
for read failures and empty files.

Source: Linters/SAST tools

bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/styles.ts (1)

140-145: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Error styled component shadows the global Error constructor.

SonarCloud flags this. While this file only exports styled components, the name Error could cause confusion if someone adds error-handling logic here later. Consider renaming to ErrorText or ErrorMessage.

♻️ Optional rename
-const Error = styled.p`
+const ErrorText = styled.p`
   margin: 0;
   color: ${colorDanger};
   font-size: 0.8125rem;
   font-weight: 600;
 `;

And update the export:

   Error,
+  Error: ErrorText,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/styles.ts`
around lines 140 - 145, Rename the styled component currently named Error in the
markdown-import-modal styles to avoid shadowing the global Error constructor;
update the declaration and any export/use sites in this module to a clearer name
like ErrorText or ErrorMessage, using the existing styled component definition
as the primary symbol to locate and refactor.

Source: Linters/SAST tools

bbb-shared-notes-server/src/redis/service/pushInitialContent.ts (1)

15-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting seed helpers to reduce cognitive complexity.

SonarCloud reports cognitive complexity of 17 (threshold 15). Extracting the JSON-seed block (lines 51-67) and the markdown-seed block (lines 69-76) into small helper functions would bring the main function under the threshold while improving readability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@bbb-shared-notes-server/src/redis/service/pushInitialContent.ts` at line 15,
The pushInitialContent function has too much cognitive complexity because the
JSON-seed and markdown-seed branches are embedded inline. Extract those two
blocks into small helper functions (for example, helpers used by
pushInitialContent) and have the main function delegate to them so the control
flow is flatter and easier to read while keeping the same behavior.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bbb-shared-notes-server/src/redis/service/pushInitialContent.ts`:
- Around line 69-76: The markdown fallback in pushInitialContent should mirror
the JSON path’s validation and rollback behavior. In pushInitialContent, check
the result of editor.tryParseMarkdownToBlocks before seeding so empty/null
markdown does not return statusCode: "document_loaded", and wrap
editor.blocksToYXmlFragment in a try/catch that deletes the fragment on failure
just like the JSON branch. Keep the existing logger.info and return flow only
after successful seeding, and preserve the outer error handling for
unknown_error.

In
`@bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/component.tsx`:
- Around line 184-199: `applyImport` in `component.tsx` needs error handling
around the markdown parse/apply flow because
`editor.tryParseMarkdownToBlocks(markdown)` can reject and currently leaves the
modal open with no feedback. Wrap the logic inside `applyImport` in a try/catch,
set the existing error state used by this modal when parsing or
inserting/replacing blocks fails, and only call `onClose()` on success so users
can retry after a failure.

---

Nitpick comments:
In `@bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java`:
- Around line 415-430: The URL fetch logic in fetchUrlContent hardcodes the 6000
ms timeout in both redirect resolution and download, so make this value
configurable like maxSharedNotesInitialContentUrlPayloadSize. Add a dedicated
timeout field (for example, maxSharedNotesInitialContentUrlResponseTimeout) with
a setter, then use that field in redirectFollower.followRedirectSecure and
secureUrlDownloader.downloadToString so MeetingService stays consistent with the
other URL loaders.

In `@bbb-shared-notes-server/src/redis/service/pushInitialContent.ts`:
- Line 15: The pushInitialContent function has too much cognitive complexity
because the JSON-seed and markdown-seed branches are embedded inline. Extract
those two blocks into small helper functions (for example, helpers used by
pushInitialContent) and have the main function delegate to them so the control
flow is flatter and easier to read while keeping the same behavior.

In
`@bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/component.tsx`:
- Around line 157-171: The markdown import flow still uses callback-based
FileReader#readAsText in the file-loading logic, and this should be refactored
to the modern Blob#text() promise API. Update the file handling in the markdown
import modal component (the reader setup inside the import path) to await
file.text(), then keep the existing state updates for setFileName, setFileSize,
setMarkdown, and setError, while preserving the current error handling behavior
for read failures and empty files.

In
`@bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/styles.ts`:
- Around line 140-145: Rename the styled component currently named Error in the
markdown-import-modal styles to avoid shadowing the global Error constructor;
update the declaration and any export/use sites in this module to a clearer name
like ErrorText or ErrorMessage, using the existing styled component definition
as the primary symbol to locate and refactor.
🪄 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: b01da62b-3bab-4833-b33e-312e12e27601

📥 Commits

Reviewing files that changed from the base of the PR and between 0427d9c and 5afcf65.

📒 Files selected for processing (34)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/pads/PadslHdlrHelpers.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Meeting2x.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PadsMsgs.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/MeetingService.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/RedirectFollowerService.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/impl/SharedNotesRedirectValidatorService.java
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-shared-notes-server/src/redis/handler.ts
  • bbb-shared-notes-server/src/redis/service/pushInitialContent.ts
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/import-context.tsx
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/component.tsx
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/markdown-import-modal/styles.ts
  • bigbluebutton-html5/imports/ui/components/notes/component.tsx
  • bigbluebutton-html5/imports/ui/components/notes/notes-dropdown/component.tsx
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts
  • bigbluebutton-html5/private/config/settings.yml
  • bigbluebutton-html5/public/locales/en.json
  • bigbluebutton-tests/playwright/core/elements.ts
  • bigbluebutton-tests/playwright/core/helpers.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.spec.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/markdown.ts
  • bigbluebutton-tests/playwright/sharednotes/blocknote/util.ts
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties
  • bigbluebutton-web/grails-app/conf/spring/resources.xml
  • bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy
  • docs/docs/data/create.tsx
  • docs/docs/development/api.md
💤 Files with no reviewable changes (1)
  • bbb-common-web/src/main/java/org/bigbluebutton/api/service/RedirectFollowerService.java
✅ Files skipped from review due to trivial changes (2)
  • bigbluebutton-web/grails-app/conf/bigbluebutton.properties
  • docs/docs/data/create.tsx
🚧 Files skipped from review as they are similar to previous changes (11)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PadsMsgs.scala
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Meeting2x.scala
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/import-context.tsx
  • bbb-common-web/src/main/java/org/bigbluebutton/api2/IBbbWebApiGWApp.java
  • bbb-common-web/src/main/scala/org/bigbluebutton/api2/BbbWebApiGWApp.scala
  • bbb-common-web/src/main/java/org/bigbluebutton/api/ApiParams.java
  • bbb-shared-notes-server/src/redis/handler.ts
  • bigbluebutton-html5/imports/ui/components/bn-shared-notes/component.tsx
  • bigbluebutton-html5/imports/ui/components/notes/component.tsx
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/pads/PadslHdlrHelpers.scala

… limits

Wrap applyImport in try/catch: a rejected tryParseMarkdownToBlocks (malformed
markdown or a parser edge case) now surfaces a visible error and keeps the modal
open for retry, instead of leaving the promise to reject silently while the modal
freezes. Adds the parseFailed ImportError and its en.json message.

Document that the shared-notes initial-content URLs (sharedNotesInitialContentJsonUrl
and sharedNotesInitialContentMarkdownUrl) are fetched through the hardened, DNS-pinned
path: https only, capped by maxSharedNotesInitialContentUrlPayloadSize (1024 KiB) and
a 6000 ms timeout, so an http URL or an oversized/slow endpoint yields empty content
silently.
…t path

- pushInitialContent: extract seedFromJson/seedFromMarkdown helpers so the
  function cognitive complexity drops below the threshold (behavior unchanged)
- markdown-import-modal: read the uploaded file via Blob#text() instead of
  FileReader, rename the styled Error component to ErrorText, and drop the
  redundant object-literal spread on the dropzone input props
- notes-dropdown: read meetingClientSettings through globalThis
- sharednotes tests: use globalThis instead of window in the eval helper

No behavior change: html5 tsc and eslint clean, sharednotes markdown suite
13/13 passing against a from-source rebuild.
seedFromMarkdown had two gaps versus seedFromJson: it did not validate
that tryParseMarkdownToBlocks returned usable blocks (an empty result
still reported document_loaded), and it had no cleanup for a partially
written fragment if blocksToYXmlFragment threw.

Mirror the seedFromJson pattern: return null on empty blocks or on a
conversion error (rolling back any partial write), and let the caller
fall through to no_initial_content instead of a false-positive success.
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary merged commit 5de2ca0 into bigbluebutton:v3.0.x-develop Jul 16, 2026
35 checks passed
@antobinary antobinary mentioned this pull request Aug 6, 2026
9 of 13 tasks
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.

4 participants