Skip to content

Conversation

@ameer2468
Copy link
Collaborator

@ameer2468 ameer2468 commented Oct 21, 2025

Summary by CodeRabbit

  • Refactor
    • Enhanced data structure for improved owner status information handling in the share component.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 21, 2025

Walkthrough

This PR modifies the ShareHeader component to accept an optional ownerIsPro boolean field in its data object, replacing the previous logic that computed Pro status from the current user. The ownership check is also simplified to compare user IDs directly without type conversion.

Changes

Cohort / File(s) Summary
ShareHeader data augmentation
apps/web/app/s/[videoId]/_components/ShareHeader.tsx
Added optional ownerIsPro?: boolean field to data type. Updated Pro status determination to use data.ownerIsPro with nullish coalescing default. Simplified ownership check to compare user.id directly with data.ownerId.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A Pro flag arrives, so clean and bright,
No more computing left and right,
Owner's status flows upstream with grace,
Simpler logic wins the race! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "fix: video owner check pro status" directly and accurately describes the main changes in the changeset. The modifications center on fixing how the pro status of a video owner is determined in the ShareHeader component by introducing a new optional field ownerIsPro and replacing the computed ownership Pro status logic. The title is concise, clear, and specific enough that a teammate scanning the repository history would understand the primary intent of the fix without ambiguity.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch correct-video-owner-check-for-pro

📜 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 bc21c3f and 8a7fbff.

📒 Files selected for processing (1)
  • apps/web/app/s/[videoId]/_components/ShareHeader.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use a 2-space indent for TypeScript code.
Use Biome for formatting and linting TypeScript/JavaScript files by running pnpm format.

Use strict TypeScript and avoid any; leverage shared types

Files:

  • apps/web/app/s/[videoId]/_components/ShareHeader.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx}: Use kebab-case for filenames for TypeScript/JavaScript modules (e.g., user-menu.tsx).
Use PascalCase for React/Solid components.

Files:

  • apps/web/app/s/[videoId]/_components/ShareHeader.tsx
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

On the client, always use useEffectQuery or useEffectMutation from @/lib/EffectRuntime; never call EffectRuntime.run* directly in components.

Files:

  • apps/web/app/s/[videoId]/_components/ShareHeader.tsx
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/web/**/*.{ts,tsx}: Use TanStack Query v5 for all client-side server state and fetching in the web app
Mutations should call Server Actions directly and perform targeted cache updates with setQueryData/setQueriesData
Run server-side effects via the ManagedRuntime from apps/web/lib/server.ts using EffectRuntime.runPromise/runPromiseExit; do not create runtimes ad hoc
Client code should use helpers from apps/web/lib/EffectRuntime.ts (useEffectQuery, useEffectMutation, useRpcClient); never call ManagedRuntime.make inside components

Files:

  • apps/web/app/s/[videoId]/_components/ShareHeader.tsx
apps/web/app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Server components needing Effect services must call EffectRuntime.runPromise(effect.pipe(provideOptionalAuth))

Files:

  • apps/web/app/s/[videoId]/_components/ShareHeader.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
  • GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
  • GitHub Check: Analyze (rust)
🔇 Additional comments (3)
apps/web/app/s/[videoId]/_components/ShareHeader.tsx (3)

35-35: LGTM: Optional field addition is appropriate.

The optional ownerIsPro field allows upstream code to explicitly pass the video owner's Pro status, which is the correct approach for determining feature availability based on the owner's subscription level.


67-67: No issue found—type comparison is safe.

Both user.id and data.ownerId are explicitly branded with the identical User.UserId type via $type<User.UserId>(). At runtime, both are strings (nanoId produces varchar values), making the direct === comparison correct. Removing toString() is appropriate.


134-134: Fix verified: Pro status correctly determined by video owner.

The change is correctly implemented. Verification confirms that ShareHeader in page.tsx (line 709) receives the ownerIsPro field through the videoWithOrganizationInfo object, which includes the computed field from the database query that checks the video owner's subscription status.


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 38d1d7b into main Oct 21, 2025
15 checks passed
@ameer2468 ameer2468 deleted the correct-video-owner-check-for-pro branch October 21, 2025 10:55
@coderabbitai coderabbitai bot mentioned this pull request Oct 22, 2025
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.

1 participant