You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: copy the whole code block from a folded commit preview - #1237
A long commit in a list shows a server-made excerpt with a "Show more" button. When the body starts with a code block, the excerpt keeps only that block's first lines, and the copy button copied what was rendered, so it copied only part of the code.
FoldedCommitBody now pairs each code block in the preview with the matching block in the full body (the preview is the start of the body, so they line up in order). CodeBlock copies that full block's text when it has one. What the preview shows doesn't change.
Verification: a scratch render test showed that a folded preview block now gets the full block's HTML and an unfolded body doesn't. tsc shows no errors in the changed files. Lint and format checks pass. I didn't click through it in a browser because the orb has no PHP or Postgres to run the app.
Summary by CodeRabbit
Bug Fixes
Copying code from a folded commit preview now captures the complete code block, rather than only the portion currently shown. Copy behavior for fully expanded code blocks remains unchanged.
When a commit body is folded, preview code blocks now retain the corresponding full block HTML. CodeBlock uses that HTML as the copy source when provided, while preserving the existing rendered-content fallback.
Changes: Folded code copy
Layer / File(s)
Summary
Full-block data and copy flow resources/js/types/commit.ts, resources/js/components/commit-body.tsx, resources/js/components/code-block.tsx
Block segments add optional fullHtml. Folded previews assign each preview block the corresponding full-body block HTML, and CodeBlock uses it to extract copied text when present.
No actionable issue remains before merge; complete the normal checks.
Security architecture risk: Low · up to 83faa
The change affects copying from folded previews, not permissions or data access. Copying remains a user-triggered plain-text operation. No new security failure was established, although the complete conversion behavior was not verified in a running browser.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — The added copy source is the full block already supplied to the same folded-body component. Its text, including lines hidden by folding, reaches the viewer's clipboard only through the Copy button; this path does not execute the copied code.
Trust Boundaries and Controls
inferred — The new parsing step does not establish an executable-DOM attack path: fullHtml enters a detached template, whose inert contents are reduced to textContent before writeText. The live HTML-rendering path and its server-escaping dependency already existed, so they are not introduced concerns in this PR.
Resilience and Maintainability Implications
observed — Clipboard success, unsupported access, and rejected writes retain existing terminal handling: success sets copied feedback, failure clears it and shows an error, and the feedback timeout is cleared during effect cleanup. The change adds no retry, reservation, or persistent state transition.
Finishing Touches
📝 Generate docstrings
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1161.
A long commit in a list shows a server-made excerpt with a "Show more" button. When the body starts with a code block, the excerpt keeps only that block's first lines, and the copy button copied what was rendered, so it copied only part of the code.
FoldedCommitBodynow pairs each code block in the preview with the matching block in the full body (the preview is the start of the body, so they line up in order).CodeBlockcopies that full block's text when it has one. What the preview shows doesn't change.Verification: a scratch render test showed that a folded preview block now gets the full block's HTML and an unfolded body doesn't.
tscshows no errors in the changed files. Lint and format checks pass. I didn't click through it in a browser because the orb has no PHP or Postgres to run the app.Summary by CodeRabbit