Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

address review: cap existence check with .limit(1)

Olena Ponomarovaaf6f11c2cb4b
diff --git a/apps/web/actions/videos/new-comment.ts b/apps/web/actions/videos/new-comment.ts
index ea6a41ed1..8cb9b62fe 100644
--- a/apps/web/actions/videos/new-comment.ts
+++ b/apps/web/actions/videos/new-comment.ts
@@ -51,7 +51,11 @@ export async function newComment(data: {
const accessExit = await Effect.gen(function* () {
const videosPolicy = yield* VideosPolicy;
return yield* Effect.promise(() =>
- db().select({ id: videos.id }).from(videos).where(eq(videos.id, videoId)),
+ db()
+ .select({ id: videos.id })
+ .from(videos)
+ .where(eq(videos.id, videoId))
+ .limit(1),
).pipe(Policy.withPublicPolicy(videosPolicy.canView(videoId)));
}).pipe(provideOptionalAuth, EffectRuntime.runPromiseExit);