chore: update src/pages/[owner]/[repo]/issues/new.astro

swadhinbiswas committed 8 months ago
957fe2e
1 parent c0189e2
commit 957fe2e
1 file changed
+6 -1
▼src/pages/[owner]/[repo]/issues/new.astro
+6-1
6
6
import { Textarea } from "@/components/ui/textarea";
7
7
8
8
import { getDatabase, schema } from "@/db";
9
+import { canReadRepo } from "@/lib/permissions";
9
10
import { eq, and } from "drizzle-orm";
10
11
11
12
const { owner: ownerName, repo: repoName } = Astro.params;
36
37
return Astro.redirect(`/login?redirect=${Astro.url.pathname}`);
37
38
}
38
39
39
-// TODO: Check permissions (can user create issue?)
40
+// Check permissions
41
+const hasAccess = await canReadRepo(currentUser.id, repoData);
42
+if (!hasAccess) {
43
+ return Astro.redirect("/404");
44
+}
40
45
41
46
const repoForHeader = {
42
47
...repoData,
43
48