Skip to content

Conversation

@mfts
Copy link
Owner

@mfts mfts commented Oct 17, 2025

Add a toggle to presets to control the "Powered by Papermark" banner on documents.


Slack Thread

Open in Cursor Open in Web

Summary by CodeRabbit

  • New Features
    • Added Branding configuration to presets. Users can now control banner display when creating or editing presets. Settings automatically apply to documents and dataroom links using these presets, with fallback to default behavior when not specified.

@cursor
Copy link

cursor bot commented Oct 17, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Oct 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
papermark Ready Ready Preview Comment Oct 17, 2025 3:43pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 17, 2025

Walkthrough

This change adds a showBanner boolean field to presets across the schema, database, and UI. The field is integrated into preset creation/editing pages, link sheet components, webhook handlers, and API logic to enable controlling banner display through preset settings.

Changes

Cohort / File(s) Summary
Database schema
prisma/migrations/20251017000000_add_show_banner_to_presets/migration.sql, prisma/schema/link.prisma
Added optional showBanner boolean column to LinkPreset table with default value of false
Preset data schema
lib/zod/schemas/presets.ts
Added optional showBanner boolean field to PresetDataSchema in the Banner section
Preset UI pages
pages/settings/presets/[id].tsx, pages/settings/presets/new.tsx
Added ProBannerSection component to preset creation and editing forms; integrated showBanner into form state and API payloads
Link sheet components
components/links/link-sheet/index.tsx, ee/features/permissions/components/dataroom-link-sheet.tsx
Updated applyPreset logic to apply showBanner from presets with nullish coalescing fallback to previous value
Webhook service
pages/api/webhooks/services/[...path]/index.ts
Updated link/document/dataroom creation flows to use link.showBanner ?? preset?.showBanner ?? false defaulting pattern

Possibly related PRs

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Add banner toggle to presets" accurately describes the primary objective of the changeset. The PR adds support for controlling the "Powered by Papermark" banner through a preset setting, which is reflected across multiple files including schema updates (Prisma schema and Zod validation), database migration, UI components (ProBannerSection integration in preset pages), and API handlers. The title is concise, specific, and clearly communicates the main change without being vague or misleading. A teammate reviewing pull request history would understand that this PR introduces a new toggleable banner feature for presets.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7e94ee0 and db65c20.

📒 Files selected for processing (8)
  • components/links/link-sheet/index.tsx (1 hunks)
  • ee/features/permissions/components/dataroom-link-sheet.tsx (1 hunks)
  • lib/zod/schemas/presets.ts (1 hunks)
  • pages/api/webhooks/services/[...path]/index.ts (3 hunks)
  • pages/settings/presets/[id].tsx (4 hunks)
  • pages/settings/presets/new.tsx (3 hunks)
  • prisma/migrations/20251017000000_add_show_banner_to_presets/migration.sql (1 hunks)
  • prisma/schema/link.prisma (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
pages/settings/presets/[id].tsx (1)
components/links/link-sheet/pro-banner-section.tsx (1)
  • ProBannerSection (7-55)
pages/settings/presets/new.tsx (1)
components/links/link-sheet/pro-banner-section.tsx (1)
  • ProBannerSection (7-55)
🔇 Additional comments (15)
prisma/migrations/20251017000000_add_show_banner_to_presets/migration.sql (1)

1-2: LGTM!

The migration safely adds the showBanner column with a sensible default value of false. This ensures existing presets will not show the banner by default, maintaining backward compatibility.

prisma/schema/link.prisma (1)

128-129: LGTM!

The schema change is well-defined with an appropriate optional boolean type and a conservative default value. The comment clearly describes the field's purpose.

ee/features/permissions/components/dataroom-link-sheet.tsx (1)

220-220: LGTM!

The showBanner field is correctly applied using nullish coalescing, which preserves the existing value when the preset doesn't define it. This follows the same pattern used for other preset fields in the function.

lib/zod/schemas/presets.ts (1)

64-66: LGTM!

The Zod schema addition is correct and aligns with the Prisma schema. The optional boolean type and clear section comment make the validation schema easy to understand.

components/links/link-sheet/index.tsx (1)

268-268: LGTM!

Consistent implementation with the dataroom link sheet component. The nullish coalescing pattern correctly handles preset application for the showBanner field.

pages/api/webhooks/services/[...path]/index.ts (3)

491-491: LGTM!

The fallback chain link.showBanner ?? preset?.showBanner ?? false correctly prioritizes explicit link values over preset values, with a safe default of false. The optional chaining on preset? properly handles cases where no preset is provided.


703-703: LGTM!

Consistent implementation of the showBanner fallback logic in the link creation handler. The pattern matches the document creation handler and provides the same robust fallback chain.


880-880: LGTM!

The dataroom creation handler correctly implements the same showBanner fallback pattern, ensuring consistency across all webhook resource types.

pages/settings/presets/new.tsx (3)

35-35: LGTM!

The import statement correctly references the ProBannerSection component used later in the file.


318-333: LGTM!

The Branding section is well-structured and consistent with other sections in the form. The isAllowed prop correctly gates access based on the user's plan, and the ProBannerSection component receives all necessary props.


141-141: LGTM!

The showBanner field is correctly included in the preset creation payload, ensuring the value is persisted when creating new presets.

pages/settings/presets/[id].tsx (4)

34-34: LGTM!

The import is consistent with the new preset page, maintaining uniformity across preset management interfaces.


142-142: LGTM!

The initialization correctly reads the showBanner value from the preset with an appropriate fallback to false, ensuring the form state is properly populated when editing an existing preset.


193-193: LGTM!

The showBanner field is correctly included in the update payload, ensuring changes to the banner setting are persisted when editing presets.


483-497: LGTM!

The Branding section is consistent with the new preset page, providing a uniform user experience across preset creation and editing. The component integration and access control logic are appropriate.


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.

@mfts mfts marked this pull request as ready for review October 17, 2025 18:38
@mfts mfts merged commit d5b0962 into main Oct 17, 2025
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 17, 2025
@mfts mfts deleted the cursor/add-banner-toggle-to-presets-4eb8 branch November 19, 2025 11:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants