Repository navigation
Conversation
A folded commit shows only the first lines of a code block that starts it, and the copy button copied just those. The folded body now gives that block the whole block's html to copy.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Full HTML clipboard source resources/js/types/commit.ts, resources/js/components/code-block.tsx |
BodySegment block entries support optional wholeHtml. When provided, CodeBlock extracts text from that HTML for copying; otherwise, it uses the rendered code element’s text. |
Folded body source wiring resources/js/components/commit-body.tsx |
FoldedCommitBody sets wholeHtml on the preview’s first code block from the corresponding full-body block and renders the adjusted preview segments. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related PRs
- dev-null-sh/dev-null.sh#1177: This PR also changes the clipboard behavior in
CodeBlock.
Suggested reviewers: xheaven, mnapoli
Merge Risk: 
Minimal · up to 53887
-
The change has no established actionable correctness or availability risk and is suitable to merge with normal checks.
Security architecture risk: 
Minimal · up to 53887
-
The full copy source comes from the same code block already supplied to the page. Copying remains an explicit user action that writes plain text, without introducing script execution or additional data access. No material security risk was identified in the changed flow.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — A commit author can influence the complete code text copied by a viewer, including lines hidden by folding. The changed outcome is confined to the viewer's clipboard after a copy action; the source content was already available for unfolding, and this flow does not execute the copied text.
Trust Boundaries and Controls
- observed — The copy handler parses wholeHtml into a detached template without attaching its content to the active document. Only descendant text is passed to writeText, not HTML. The existing isCopyable control still determines whether the copy button is rendered.
Resilience and Maintainability Implications
- observed — The clipboard operation still reports success only after writeText resolves. Unsupported or rejected writes retain the existing failure result and user feedback. The change introduces no persistent reservation, rollback obligation, or mutation of the source segments.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#1161requires the copy button to copy the complete code block when a post is collapsed.FoldedCommitBodysupplies the full block HTML to the preview block, andCodeBlockextracts and copies that full block whenwholeHtmlis present. The existing copy path remains active whenwholeHtmlis absent.
Full details: Out of Scope Changes check
-
Explanation
The changes stay within issue
#1161. They updateFoldedCommitBody,CodeBlock, and theBodySegmenttype to pass and copy the full HTML for a folded code block. No unrelated product behavior or files are changed.
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- 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.
Summary
Closes #1161.
When a long commit starts with a code block, the log folds it and shows only the block's first lines. The copy button copied what was on screen, so you got those first lines and not the code. Now it copies the whole block, folded or not.
Changes
FoldedCommitBodygives the first code block of the preview the html of the block at the same place in the full body (wholeHtml).CommitBodies::excerpt).CodeBlockcopieswholeHtmlwhen it has one. It reads the html as text through a<template>, whose content is inert: nothing in it loads or runs, and leading newlines survive. WithoutwholeHtml, it copies the shown block as before.BodySegment's block variant gets an optional, client-onlywholeHtml.Validation
Local:
bun run test:lint: passed.bun run test:unit: passed./log/latest, with seeded commits, all folded:productionand all 30 on this branch.ls -la, thenls) before long prose: each copies its own code.Independent review
A separate reviewer did a read-only review of base
d3fc1df6against head53887c55. The first version matched every preview block against the full blocks by prefix. It failed review: a short later block could copy an earlier one, and a leading blank line was lost. The rewrite above fixes both, and the re-review of53887c55is PASS. One non-blocking nit is left as is: the<template>is created on every copy, even withoutwholeHtml.Limitations
Summary by CodeRabbit