feat: integrate Markdown into NotificationDetail - #8335
Conversation
WalkthroughAdds an ChangesNotification Description: iframe â Markdown
Estimated code review effortðŊ 2 (Simple) | âąïļ ~10 minutes Suggested reviewers
Poem
ðĨ 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: 3
Caution
Some comments are outside the diff and canât be posted inline due to platform limitations.
â ïļ Outside diff range comments (1)
packages/bruno-app/src/components/MarkDown/index.jsx (1)
9-15: ðŊ Functional Correctness | ðĄ Minor | ⥠Quick winDefault
collectionPathbefore using it in link rewriting.
NotificationDetailnow callsMarkdownwithoutcollectionPath; any markdown link beginning with.is rewritten withundefinedbecauseString.replace()coerces the replacement value. Default the prop or guardreplaceLink.Proposed minimal fix
-const Markdown = ({ collectionPath, onDoubleClick, content, allowHtml = true }) => { +const Markdown = ({ collectionPath = '', onDoubleClick, content, allowHtml = true }) => {ðĪ 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 `@packages/bruno-app/src/components/MarkDown/index.jsx` around lines 9 - 15, The collectionPath prop is used in the replaceLink function without a default value or guard, causing markdown links starting with a dot to be replaced with the string "undefined" when NotificationDetail calls Markdown without providing collectionPath. In the Markdown component function signature, either provide a default value for collectionPath (e.g., collectionPath = '') in the parameter destructuring, or add a guard within the replaceLink function to check if collectionPath is defined before using it in the String.replace() call.
ðĪ 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
`@packages/bruno-app/src/components/Notifications/NotificationsModal/NotificationDetail.js`:
- Line 47: Add a test for the NotificationDetail component that verifies the
Markdown rendering behavior with the security boundary. The test should cover
two scenarios: first, verify that valid Markdown content is properly rendered in
the notification description, and second, verify that raw HTML tags in the
notification description are not interpreted or executed (ensuring the
allowHtml={false} safety boundary is working correctly). These tests will ensure
the Markdown component with HTML disabled is functioning as intended for
displaying notification descriptions safely.
- Line 47: The Markdown component's empty onDoubleClick handler in
NotificationDetail does not properly intercept link clicks now that content is
displayed inline without iframe sandbox protection. Clicks on child elements
within links (like bold text or images inside markdown links) bypass the handler
and cause navigation. Replace the empty onDoubleClick handler with an onClick
handler that uses event.target.closest('a') to find the nearest anchor element
regardless of which child was clicked, then call preventDefault() and use
window.open with _blank to safely handle navigation for valid URLs instead of
allowing default link behavior.
In
`@packages/bruno-app/src/components/Notifications/NotificationsModal/StyledWrapper.js`:
- Around line 247-248: The detail body content in the modal has padding applied
to a flex item with width: 100%, which causes the padding to extend beyond the
container width and get clipped by the parent's overflow: hidden. In the CSS
rule containing the overflow-y: auto; and padding: 8px 12px; properties (which
appears to be for the detail body element), add box-sizing: border-box; to
ensure the padding is included within the 100% width calculation rather than
extending beyond it.
---
Outside diff comments:
In `@packages/bruno-app/src/components/MarkDown/index.jsx`:
- Around line 9-15: The collectionPath prop is used in the replaceLink function
without a default value or guard, causing markdown links starting with a dot to
be replaced with the string "undefined" when NotificationDetail calls Markdown
without providing collectionPath. In the Markdown component function signature,
either provide a default value for collectionPath (e.g., collectionPath = '') in
the parameter destructuring, or add a guard within the replaceLink function to
check if collectionPath is defined before using it in the String.replace() call.
ðŠ 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6485f6eb-ae9f-4113-9e12-583430ff449b
ð Files selected for processing (3)
packages/bruno-app/src/components/MarkDown/index.jsxpackages/bruno-app/src/components/Notifications/NotificationsModal/NotificationDetail.jspackages/bruno-app/src/components/Notifications/NotificationsModal/StyledWrapper.js
Description
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
New Features
Improvements