Skip to content

Conversation

@ameer2468
Copy link
Contributor

@ameer2468 ameer2468 commented Sep 8, 2025

This PR:

  • Fixes has password check, its type string needs which had to be casted to number.
  • Improve check for owner is pro status.

Summary by CodeRabbit

  • New Features

    • More consistent watermark visibility based on the video owner’s Pro status when sharing videos.
  • Refactor

    • Simplified how the app determines an owner’s Pro status, improving reliability across the share page and related flows.
    • Standardized boolean handling for protection indicators (e.g., password presence) for clearer, more consistent behavior.
  • Chores

    • Internal data shape streamlined to reduce complexity and improve maintainability, with no expected changes to the user interface.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Replaces nested owner subscription fields with a single ownerIsPro flag. Updates SQL queries to compute ownerIsPro as 1/0, maps it to boolean, and propagates it through page data and Share components. Adjusts watermark gating and prop types to use ownerIsPro instead of the removed owner object.

Changes

Cohort / File(s) Summary of Changes
Type shape replacement: owner → ownerIsPro
apps/web/app/s/[videoId]/Share.tsx, apps/web/app/s/[videoId]/_components/ShareVideo.tsx
Public types/props updated to drop nested owner {stripeSubscriptionStatus, thirdPartyStripeSubscriptionId} and use optional boolean ownerIsPro. Removed userIsPro import and related logic; gating now reads data.ownerIsPro.
Query and mapping updates
apps/web/app/s/[videoId]/page.tsx
Rewrote selections to compute ownerIsPro via SQL IF(...) returning 1/0; updated AuthorizedContent projections similarly. Mapped numeric fields to booleans: ownerIsPro and hasPassword. Adjusted function signatures and downstream usage accordingly.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client as Client
  participant Page as ShareVideoPage (page.tsx)
  participant DB as DB (videos + owner info)
  participant Comp as ShareVideo (component)
  participant UI as UI

  Client->>Page: Request /s/[videoId]
  Page->>DB: SELECT ..., ownerIsPro = IF(stripeStatus='active' OR thirdPartyId IS NOT NULL, 1, 0), hasPassword = IF(...,1,0)
  DB-->>Page: Row with ownerIsPro: 0/1, hasPassword: 0/1
  Note over Page: Convert Number(...) === 1 → boolean
  Page->>Comp: Props data { ..., ownerIsPro: boolean }
  Comp->>UI: Render with watermark gating using ownerIsPro
  UI-->>Client: Share view
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • fix: hide watermark for pro users #989 — Earlier change introduced nested owner with Stripe fields and computed pro status; this PR removes that object and replaces it with a single ownerIsPro flag, directly revising the same flow and files.

Poem

A rabbit taps SQL with nimble paws,
IFs hop to booleans, obeying laws.
No stripes to chase, just pro or no—
A cleaner burrow where data flows.
I thump approval, whiskers aglow,
Share screens shimmer—onward we go! 🐇✨


📜 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 196aad9 and 2f43b5b.

📒 Files selected for processing (3)
  • apps/web/app/s/[videoId]/Share.tsx (1 hunks)
  • apps/web/app/s/[videoId]/_components/ShareVideo.tsx (2 hunks)
  • apps/web/app/s/[videoId]/page.tsx (5 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch safer-check

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.

@ameer2468 ameer2468 merged commit ce505f2 into main Sep 8, 2025
14 of 15 checks passed
@ameer2468 ameer2468 deleted the safer-check branch September 8, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants