-
Notifications
You must be signed in to change notification settings - Fork 1.3k
web: fix video owner pro check #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3f5c7bc
2c4c410
e68957c
e3b25de
ae3ef1d
9b26d12
8d4f42d
08ff461
6f59fed
f5e1c65
609278a
0f3dda7
d4c17c4
952f019
badaa37
7da87fe
73bc732
a42f264
cdbeced
c52cf61
b81659a
906d278
c70d720
2a1b233
6594be4
4cfeedd
5ee586f
9fb84d0
44aff44
724a038
b54a556
9088554
dc24b11
8a644fe
0d602f7
47c0b9f
7d3645a
f9e1710
c56f999
a8ab75b
63d06c2
6c56457
3004f01
60ec6de
6facdf6
a6f3843
8e7372a
16c5b6b
15a0935
9858c08
a2a136c
2643d9f
b2a9c47
00e5948
fad4ee8
f504a30
09d7373
3995610
60235fe
b4595bb
313669b
6af12d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||
| import type { userSelectProps } from "@cap/database/auth/session"; | ||||||||
| import type { comments as commentsSchema, videos } from "@cap/database/schema"; | ||||||||
| import { classNames } from "@cap/utils"; | ||||||||
| import { classNames, userIsPro } from "@cap/utils"; | ||||||||
| import type { Video } from "@cap/web-domain"; | ||||||||
| import clsx from "clsx"; | ||||||||
| import { AnimatePresence, motion } from "framer-motion"; | ||||||||
|
|
@@ -141,6 +141,8 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>( | |||||||
| setActiveTab(tabId); | ||||||||
| }; | ||||||||
|
|
||||||||
| const isVideoOwnerPro = user && data.ownerId === user.id && userIsPro(user); | ||||||||
|
|
||||||||
|
Comment on lines
+144
to
+145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Compute Current expression infers - const isVideoOwnerPro = user && data.ownerId === user.id && userIsPro(user);
+ const isOwner = user?.id === data.ownerId;
+ const isVideoOwnerPro: boolean | null = isOwner ? userIsPro(user) : null;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||
| const renderTabContent = () => { | ||||||||
| switch (activeTab) { | ||||||||
| case "activity": | ||||||||
|
|
@@ -181,7 +183,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>( | |||||||
| isSummaryDisabled={videoSettings?.disableSummary} | ||||||||
| initialAiData={aiData || undefined} | ||||||||
| aiGenerationEnabled={aiGenerationEnabled} | ||||||||
| user={user} | ||||||||
| isVideoOwnerPro={isVideoOwnerPro} | ||||||||
| /> | ||||||||
| ); | ||||||||
| case "transcript": | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use tri‑state
isVideoOwnerProto avoid showing owner CTAs to viewers.Make
isVideoOwnerPro: true | false | nullusing the already‑computedisOwner. This also fixes theuser | booleaninference from the chained&&.📝 Committable suggestion
🤖 Prompt for AI Agents