Skip to content

Commit 15d8828

Browse files
committed
cleanup isPro handling + make /signup work in self hosted
1 parent 4886f65 commit 15d8828

File tree

6 files changed

+11
-44
lines changed

6 files changed

+11
-44
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/web/app/s/[videoId]/Share.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ interface ShareProps {
4141
customDomain: string | null;
4242
domainVerified: boolean;
4343
videoSettings?: OrganizationSettings | null;
44-
ownerIsPro?: boolean;
4544
userOrganizations?: { id: string; name: string }[];
4645
initialAiData?: {
4746
title?: string | null;
@@ -131,7 +130,6 @@ const useVideoStatus = (
131130
export const Share = ({
132131
data,
133132
comments,
134-
ownerIsPro,
135133
views,
136134
initialAiData,
137135
aiGenerationEnabled,
@@ -310,7 +308,6 @@ export const Share = ({
310308
createdAt: effectiveDate,
311309
transcriptionStatus,
312310
}}
313-
ownerIsPro={ownerIsPro}
314311
videoSettings={videoSettings}
315312
commentsData={commentsData}
316313
setCommentsData={setCommentsData}

apps/web/app/s/[videoId]/_components/Sidebar.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ interface SidebarProps {
3838
processing?: boolean;
3939
} | null;
4040
aiGenerationEnabled?: boolean;
41-
ownerIsPro?: boolean;
4241
}
4342

4443
const TabContent = motion.div;
@@ -77,10 +76,8 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(
7776
views,
7877
videoSettings,
7978
onSeek,
80-
videoId,
8179
aiData,
8280
aiGenerationEnabled = false,
83-
ownerIsPro,
8481
},
8582
ref,
8683
) => {
@@ -100,7 +97,7 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(
10097
: !(
10198
videoSettings?.disableTranscript ??
10299
data.orgSettings?.disableTranscript
103-
)
100+
)
104101
? "transcript"
105102
: "activity";
106103

@@ -160,19 +157,19 @@ export const Sidebar = forwardRef<{ scrollToBottom: () => void }, SidebarProps>(
160157
handleCommentSuccess={handleCommentSuccess}
161158
isOwnerOrMember={isOwnerOrMember}
162159
onSeek={onSeek}
163-
videoId={videoId}
160+
videoId={data.id}
164161
/>
165162
</Suspense>
166163
);
167164
case "summary":
168165
return (
169166
<Summary
170-
videoId={videoId}
167+
videoId={data.id}
168+
ownerIsPro={data.owner.isPro}
171169
onSeek={onSeek}
172170
isSummaryDisabled={videoSettings?.disableSummary}
173171
initialAiData={aiData || undefined}
174172
aiGenerationEnabled={aiGenerationEnabled}
175-
ownerIsPro={ownerIsPro}
176173
/>
177174
);
178175
case "transcript":

apps/web/app/s/[videoId]/_components/tabs/Summary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ interface SummaryProps {
2222
};
2323
aiGenerationEnabled?: boolean;
2424
isSummaryDisabled?: boolean;
25-
ownerIsPro?: boolean;
25+
ownerIsPro: boolean;
2626
}
2727

2828
const formatTime = (time: number) => {

apps/web/app/s/[videoId]/page.tsx

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,6 @@ async function getSharedSpacesForVideo(videoId: Video.VideoId) {
108108
return sharedSpaces;
109109
}
110110

111-
type VideoWithOrganization = typeof videos.$inferSelect & {
112-
sharedOrganization?: {
113-
organizationId: string;
114-
} | null;
115-
organizationMembers?: string[];
116-
organizationId?: string;
117-
sharedOrganizations?: { id: string; name: string }[];
118-
password?: string | null;
119-
hasPassword?: boolean;
120-
ownerIsPro?: boolean;
121-
orgSettings?: OrganizationSettings | null;
122-
};
123-
124111
const ALLOWED_REFERRERS = [
125112
"x.com",
126113
"twitter.com",
@@ -277,8 +264,6 @@ export default async function ShareVideoPage(props: PageProps<"/s/[videoId]">) {
277264
.select({
278265
id: videos.id,
279266
name: videos.name,
280-
ownerName: users.name,
281-
ownerImageUrlOrKey: users.image,
282267
orgId: videos.orgId,
283268
createdAt: videos.createdAt,
284269
updatedAt: videos.updatedAt,
@@ -369,9 +354,6 @@ async function AuthorizedContent({
369354
owner: InferSelectModel<typeof users>;
370355
sharedOrganization: { organizationId: Organisation.OrganisationId } | null;
371356
hasPassword: boolean;
372-
ownerIsPro?: boolean;
373-
ownerName?: string | null;
374-
ownerImageUrlOrKey?: ImageUpload.ImageUrlOrKey | null;
375357
orgSettings?: OrganizationSettings | null;
376358
videoSettings?: OrganizationSettings | null;
377359
};
@@ -474,13 +456,6 @@ async function AuthorizedContent({
474456
.select({
475457
id: videos.id,
476458
name: videos.name,
477-
ownerId: videos.ownerId,
478-
ownerName: users.name,
479-
ownerImageUrlOrKey: users.image,
480-
ownerIsPro:
481-
sql`${users.stripeSubscriptionStatus} IN ('active','trialing','complete','paid') OR ${users.thirdPartyStripeSubscriptionId} IS NOT NULL`.mapWith(
482-
Boolean,
483-
),
484459
createdAt: videos.createdAt,
485460
updatedAt: videos.updatedAt,
486461
bucket: videos.bucket,
@@ -503,7 +478,7 @@ async function AuthorizedContent({
503478
})
504479
.from(videos)
505480
.leftJoin(sharedVideos, eq(videos.id, sharedVideos.videoId))
506-
.leftJoin(users, eq(videos.ownerId, users.id))
481+
.innerJoin(users, eq(videos.ownerId, users.id))
507482
.leftJoin(organizations, eq(videos.orgId, organizations.id))
508483
.where(eq(videos.id, videoId))
509484
.execute();
@@ -720,19 +695,17 @@ async function AuthorizedContent({
720695

721696
const videoWithOrganizationInfo = await Effect.gen(function* () {
722697
const imageUploads = yield* ImageUploads;
723-
const ownerIsPro = userIsPro(video.owner);
724698

725699
return {
726700
...video,
727701
owner: {
728702
id: video.owner.id,
729703
name: video.owner.name,
730-
isPro: ownerIsPro,
731-
image: video.ownerImageUrlOrKey
732-
? yield* imageUploads.resolveImageUrl(video.ownerImageUrlOrKey)
704+
isPro: userIsPro(video.owner),
705+
image: video.owner.image
706+
? yield* imageUploads.resolveImageUrl(video.owner.image)
733707
: null,
734708
},
735-
ownerIsPro,
736709
organization: {
737710
organizationMembers: membersList.map((member) => member.userId),
738711
organizationId: video.sharedOrganization?.organizationId ?? undefined,
@@ -768,7 +741,6 @@ async function AuthorizedContent({
768741
<Share
769742
data={videoWithOrganizationInfo}
770743
videoSettings={videoWithOrganizationInfo.settings}
771-
ownerIsPro={videoWithOrganizationInfo.ownerIsPro}
772744
comments={commentsPromise}
773745
views={viewsPromise}
774746
customDomain={customDomain}

apps/web/middleware.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export async function middleware(request: NextRequest) {
4545
path.startsWith("/onboarding") ||
4646
path.startsWith("/api") ||
4747
path.startsWith("/login") ||
48+
path.startsWith("/signup") ||
4849
path.startsWith("/invite") ||
4950
path.startsWith("/self-hosting") ||
5051
path.startsWith("/terms") ||

0 commit comments

Comments
 (0)