forge
Explore
Log in

Don't you dare go Hollow

✨ align with backend student-only gates - client: EN/TR error strings for new 400/403 messages (enroll/grade/roll-call targets, exam sit incl. exam-room WS frame) - exam-detail: own-result fetch + section gate on isStudent(), drop unused isTeacherPlus memo - docs: guard table isStudent() + student-filtered picker rows, next-steps entry

Browse files at this commit

267d95ddf461b1033558ff890c4916aac3acae10Ahmet Kaan GümüşParent: 6097c05
  • feat
    • ✨ align with backend student-only gates - client: EN/TR error strings for new 400/403 messages (enroll/grade/roll-call targets, exam sit incl. exam-room WS frame) - exam-detail: own-result fetch + section gate on isStudent(), drop unused isTeacherPlus memo - docs: guard table isStudent() + student-filtered picker rows, next-steps entry
Show full message
feat: ✨ align with backend student-only gates - client: EN/TR error strings for new 400/403 messages (enroll/grade/roll-call targets, exam sit incl. exam-room WS frame) - exam-detail: own-result fetch + section gate on isStudent(), drop unused isTeacherPlus memo - docs: guard table isStudent() + student-filtered picker rows, next-steps entry
docs/frontend-next-steps.mdmodified+1 -0
@@ -65,6 +65,7 @@ validation, and list filtering cleanup.
6565 | Session edit | `patchSessionById` + edit SidePanel in course sessions |
6666 | Manager work log | `/management/staff-work` + get/patch/delete work APIs |
6767 | Work route guard | `beforeLoad` teacher+ on `/work` |
68+| BE student-only gates (enroll/sit/grade/roll call) | Localized error strings for the new 400/403 messages; student-marks lookup picker filters `role=student`; exam-detail own-result gates on `isStudent()` |
6869
6970 ### Incomplete Product Features
7071
docs/role-scope-matrix.mdmodified+2 -1
@@ -103,7 +103,8 @@
103103 | `RouteGuard exactRole` | `/marks` | Student-only page (FE presentation; BE allows the own-data read) |
104104 | `RouteGuard minRole` | Management pages | Teacher+ or manager+ |
105105 | `beforeLoad` redirect (router) | Route definition | Redirects before page JS loads |
106-| `!isTeacherPlus()` | In-page logic | Exam room CTA, event self-mark |
106+| `isStudent()` | In-page logic | Exam room CTA, own-result section on exam detail |
107+| `UserSearchSelect role="student"` | Enroll picker, student-marks lookup | Offers only students — matches the BE student-only walls |
107108 | `canManage()` / `hasCourseManagementRights()` | Detail pages | Course action visibility |
108109 | `canCreate` | List pages | Create button visibility |
109110 | Nav `exactRole` | Sidebar items | Student-only nav links |
src/api/client.tsmodified+16 -0
@@ -73,6 +73,22 @@ const API_ERROR_MESSAGES: Record<string, Record<Locale, string>> = {
7373 en: "This attempt is closed. Answers are read-only.",
7474 tr: "Bu oturum kapalı. Cevaplar salt okunur.",
7575 },
76+ "only students can sit exams": {
77+ en: "Only students can take exams.",
78+ tr: "Sınava yalnızca öğrenciler girebilir.",
79+ },
80+ "user_id: only students can be enrolled in a course": {
81+ en: "Only students can be enrolled in a course.",
82+ tr: "Derse yalnızca öğrenciler kaydedilebilir.",
83+ },
84+ "user_id: only students can be graded": {
85+ en: "Only students can be graded.",
86+ tr: "Yalnızca öğrencilere not verilebilir.",
87+ },
88+ "user_id: only students can be marked present in a lesson": {
89+ en: "Only students can be marked on a lesson roll call.",
90+ tr: "Ders yoklamasında yalnızca öğrenciler işaretlenebilir.",
91+ },
7692 };
7793
7894 function currentLocale(): Locale {
src/pages/exam-detail-page.tsxmodified+2 -3
@@ -70,7 +70,6 @@ function ExamDetailContent() {
7070
7171 const [exam, { refetch: refetchExam }] = createResource(id, (examId) => getExamById(examId));
7272 const [settings] = createResource(() => getSettings());
73- const isTeacherPlus = createMemo(() => hasMinRole(auth.user()?.role, "teacher"));
7473 const isStudent = createMemo(() => auth.user()?.role === "student");
7574
7675 const hasCourseManagementRights = () => {
@@ -97,7 +96,7 @@ function ExamDetailContent() {
9796 });
9897
9998 const [ownResult] = createResource(
100- () => (!isTeacherPlus() ? id() : null),
99+ () => (isStudent() ? id() : null),
101100 async (examId) => {
102101 if (!examId) return null;
103102 try {
@@ -361,7 +360,7 @@ function ExamDetailContent() {
361360 </div>
362361 </SectionDisclosure>
363362
364- <Show when={!isTeacherPlus() && !isScheduled()}>
363+ <Show when={isStudent() && !isScheduled()}>
365364 <SectionDisclosure
366365 open={openSections().ownResult}
367366 onToggle={() => toggleSection("ownResult")}