Skip to content

fix: allow PDF preview on readonly public pages#14761

Merged
darkskygit merged 1 commit intotoeverything:canaryfrom
ibex088:fix/public-pdf-preview-readonly-share
Apr 1, 2026
Merged

fix: allow PDF preview on readonly public pages#14761
darkskygit merged 1 commit intotoeverything:canaryfrom
ibex088:fix/public-pdf-preview-readonly-share

Conversation

@ibex088
Copy link
Copy Markdown
Contributor

@ibex088 ibex088 commented Apr 1, 2026

fixes #14727

https://www.loom.com/share/dfcd558332404896b3e02aad97b18f02

Summary by CodeRabbit

  • Bug Fixes
    • PDF attachments can now be previewed in read-only documents.

@ibex088 ibex088 requested a review from a team as a code owner April 1, 2026 10:21
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a2c1e74e-264f-4abb-bd5b-7d0f81dd040e

📥 Commits

Reviewing files that changed from the base of the PR and between 91ad783 and dd6740e.

📒 Files selected for processing (1)
  • blocksuite/affine/blocks/attachment/src/attachment-block.ts

📝 Walkthrough

Walkthrough

Updated the @Peekable decorator's predicate for attachment blocks to remove the readonly store restriction, allowing PDF attachments to be peeked in readonly contexts such as public or unauthenticated views.

Changes

Cohort / File(s) Summary
Attachment Block Peek Enablement
blocksuite/affine/blocks/attachment/src/attachment-block.ts
Removed !model.store.readonly condition from the peek enable predicate. The decorator now enables peeking for PDF attachments regardless of store readonly status, permitting preview functionality in public/unauthenticated shares.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A hop and a skip, PDFs now peek,
In public views, both strong and meek,
No readonly chains can hold them back,
Files shine bright on any track!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title directly describes the main change: enabling PDF preview on readonly public pages by removing the readonly store restriction.
Linked Issues check ✅ Passed The PR addresses issue #14727 by removing the readonly store check that prevented PDF attachment access in readonly/public views, restoring functionality for unauthenticated users.
Out of Scope Changes check ✅ Passed The change is focused solely on the @Peekable enableOn predicate for AttachmentBlockComponent, directly related to enabling PDF preview in readonly contexts as per the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 57.37%. Comparing base (91ad783) to head (dd6740e).
⚠️ Report is 1 commits behind head on canary.

Files with missing lines Patch % Lines
...e/affine/blocks/attachment/src/attachment-block.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           canary   #14761      +/-   ##
==========================================
- Coverage   57.82%   57.37%   -0.46%     
==========================================
  Files        2960     2960              
  Lines      165735   165735              
  Branches    24428    24301     -127     
==========================================
- Hits        95841    95092     -749     
- Misses      66848    67590     +742     
- Partials     3046     3053       +7     
Flag Coverage Δ
server-test 76.31% <ø> (-0.82%) ⬇️
unittest 34.61% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@darkskygit darkskygit merged commit 8c07ea2 into toeverything:canary Apr 1, 2026
61 of 62 checks passed
@ibex088 ibex088 deleted the fix/public-pdf-preview-readonly-share branch April 1, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Bug]: Attachments cannot be downloaded from public/unauthenticated view, even if page is set to "public"

2 participants