Skip to content

fix(submission): show blocked view when instructor toggles student view#8269

Open
enkr1 wants to merge 1 commit intoCoursemology:masterfrom
enkr1:fix/blocked-view-student-toggle
Open

fix(submission): show blocked view when instructor toggles student view#8269
enkr1 wants to merge 1 commit intoCoursemology:masterfrom
enkr1:fix/blocked-view-student-toggle

Conversation

@enkr1
Copy link

@enkr1 enkr1 commented Mar 21, 2026

Closes #5488

Problem

When "block student viewing after submission" is enabled, students see a lock screen after finalizing. But when an instructor toggles "Student View" on the same submission, they still see the full submission — the blocked view is not shown.

Root Cause

The block check only runs on the backend (submission_view_blocked?), which checks course_user.student?. Instructors are never students, so the block is never triggered — even in student view mode.

Fix

Backend (edit.json.jbuilder):

  • Expose blockStudentViewingAfterSubmitted in the assessment JSON so the frontend knows the setting is enabled

Frontend (SubmissionEditIndex):

  • When grader toggles to student view (graderView: false), check if the submission would be blocked (not attempting, not published, setting enabled)
  • If blocked, render <BlockedSubmission /> in place of the submission content
  • Assessment header + student view toggle remain visible so the instructor can switch back

Not changed

  • Backend block logic for actual students is untouched
  • No new dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant