fix users without session cannot view shared videos
This commit is contained in:
parent
d6f2be85d2
commit
0f58a9fda4
1 changed files with 17 additions and 15 deletions
|
|
@ -65,10 +65,11 @@ export const videoRouter = createTRPCRouter({
|
|||
throw new TRPCError({ code: "NOT_FOUND" });
|
||||
}
|
||||
|
||||
if (!session || (video.userId !== session?.user.id && !video.sharing)) {
|
||||
if (video.userId !== session?.user.id && !video.sharing) {
|
||||
throw new TRPCError({ code: "FORBIDDEN" });
|
||||
}
|
||||
|
||||
if (session) {
|
||||
posthog.capture({
|
||||
distinctId: session.user.id,
|
||||
event: "viewing video",
|
||||
|
|
@ -83,6 +84,7 @@ export const videoRouter = createTRPCRouter({
|
|||
},
|
||||
});
|
||||
void posthog.shutdownAsync();
|
||||
}
|
||||
|
||||
const getObjectCommand = new GetObjectCommand({
|
||||
Bucket: env.AWS_BUCKET_NAME,
|
||||
|
|
|
|||
Loading…
Reference in a new issue