Repository navigation
fix: SVG support for notifications - #25281
Conversation
WalkthroughThe Toast component is extended to support custom plugin icons passed as objects. A new Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@bigbluebutton-html5/imports/ui/components/common/toast/component.jsx`:
- Around line 21-31: The condition checking for the custom SVG icon path only
verifies that the 'svgContent' property exists in the icon object using the `in`
operator, but does not verify that svgContent actually has a truthy value. This
means an empty, null, or undefined svgContent will still route to the
custom-icon branch, rendering a blank icon instead of falling through to the
iconName fallback. Add an additional guard to check that svgContent is not only
present but also has a truthy value before taking the custom-icon rendering
branch in the if statement that checks `'svgContent' in icon`.
🪄 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: dab6c626-36c2-45a2-8116-2024a596853c
📒 Files selected for processing (2)
bigbluebutton-html5/imports/ui/components/common/toast/component.jsxbigbluebutton-html5/imports/ui/components/common/toast/styles.js
| if (icon && typeof icon === 'object' && 'svgContent' in icon) { | ||
| return ( | ||
| <Styled.ToastCustomIcon> | ||
| <PluginButtonIcon>{icon.svgContent}</PluginButtonIcon> | ||
| </Styled.ToastCustomIcon> | ||
| ); | ||
| } | ||
|
|
||
| let iconName = icon; | ||
| if (icon && typeof icon === 'object' && 'iconName' in icon) iconName = icon.iconName; | ||
|
|
There was a problem hiding this comment.
Guard svgContent value before taking the custom-icon branch.
Using only 'svgContent' in icon can route to the SVG path even when svgContent is empty/undefined, which bypasses iconName/default fallback and can render a blank icon.
Suggested fix
const renderIcon = (icon, type) => {
- if (icon && typeof icon === 'object' && 'svgContent' in icon) {
+ if (icon && typeof icon === 'object' && icon.svgContent) {
return (
<Styled.ToastCustomIcon>
<PluginButtonIcon>{icon.svgContent}</PluginButtonIcon>
</Styled.ToastCustomIcon>
);
}
let iconName = icon;
if (icon && typeof icon === 'object' && 'iconName' in icon) iconName = icon.iconName;
return <Icon iconName={iconName || defaultIcons[type]} />;
};📝 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.
| if (icon && typeof icon === 'object' && 'svgContent' in icon) { | |
| return ( | |
| <Styled.ToastCustomIcon> | |
| <PluginButtonIcon>{icon.svgContent}</PluginButtonIcon> | |
| </Styled.ToastCustomIcon> | |
| ); | |
| } | |
| let iconName = icon; | |
| if (icon && typeof icon === 'object' && 'iconName' in icon) iconName = icon.iconName; | |
| if (icon && typeof icon === 'object' && icon.svgContent) { | |
| return ( | |
| <Styled.ToastCustomIcon> | |
| <PluginButtonIcon>{icon.svgContent}</PluginButtonIcon> | |
| </Styled.ToastCustomIcon> | |
| ); | |
| } | |
| let iconName = icon; | |
| if (icon && typeof icon === 'object' && 'iconName' in icon) iconName = icon.iconName; | |
🤖 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/common/toast/component.jsx` around
lines 21 - 31, The condition checking for the custom SVG icon path only verifies
that the 'svgContent' property exists in the icon object using the `in`
operator, but does not verify that svgContent actually has a truthy value. This
means an empty, null, or undefined svgContent will still route to the
custom-icon branch, rendering a blank icon instead of falling through to the
iconName fallback. Add an additional guard to check that svgContent is not only
present but also has a truthy value before taking the custom-icon rendering
branch in the if statement that checks `'svgContent' in icon`.
✅ Automated tests have passed! |
Review Report — PR #25281: fix: SVG support for notificationsReviewed by: Cláudio Promptoso 1. SummaryThis PR teaches the Verdict: The PR resolves what it promises — the 2. Static Checks
ESLint warnings (pre-existing in the file, not from this PR):
3. Findings(a) [Minor · High confidence] Inconsistent icon resolution between Toast and PluginButton
(b) [Minor · Medium confidence] Defensive edge case: icon object with no recognized keys
(c) [Nit · High confidence]
|
| Test | Objective | Result |
|---|---|---|
| String icon — audio join toast | Verifies string-icon path (regression) | ✅ Passed |
| Fallback — raise-hand toast | Verifies default icon when no icon passed | ✅ Passed |
| SVG content — DOM injection | Verifies SVG renders inside toast container | ✅ Passed (SVG bounding box: 24×24 at pos 1038,83) |
| Edge — unknown object keys | Verifies app doesn"t crash with unrecognized icon object | ✅ Passed |
Caveats:
- The SVG path was verified at DOM level via SVG injection into the toast container. Full end-to-end plugin→notify→toast chain was not exercised because the plugin SDK event dispatch requires a plugin manifest + running plugin, which is beyond the scope of this review environment.
- The
iconNameobject path was verified through code analysis (same resolution as PluginButton).
Test files location: bigbluebutton-tests/playwright/notifications/review-toast-pr25281.spec.ts — review-only, should not be merged unless the PR author adopts them.
6. Environment
- URL: https://pr25281-ip-10-111-12-106.bbb.imdt.dev/bigbluebutton/
- API-Mate: https://pr25281-ip-10-111-12-106.bbb.imdt.dev/api-mate/#server=https://pr25281-ip-10-111-12-106.bbb.imdt.dev/bigbluebutton/&sharedSecret=H697FmGC9Oc09hlQBbBaIcuRFuzokzL0b8TqqD88k
- Build: from-source,
run_bbb_from_source.sh --unattended, rc=0 - Line: v3.0.x-develop (3.0)
- Access: Requires VPN — connect before opening. Configuração mudou em 13/06/2026: se você já tinha VPN e não conecta, precisa re-solicitar em DM que eu configuro o novo endpoint.
408f27b
into
bigbluebutton:v3.0.x-develop
|



What does this PR do:
Previously, even though passing an SVG content as the toast icon, the toast would be displayed with no icon at all.
Now this PR fix it.