fix(submission): show blocked view when instructor toggles student view#8269
fix(submission): show blocked view when instructor toggles student view#8269enkr1 wants to merge 1 commit intoCoursemology:masterfrom
Conversation
|
Quick ping on this bug fix — the core issue is that instructors in student view bypass the block check since they're not actual students. The fix exposes the setting to the frontend so it can render the blocked view when graderView is toggled off. No backend logic for actual students is changed. Let me know if the approach makes sense! |
Hi @enkr1 , the |
| # If submitting with incorrect answers is not allowed, we must show the answer to students regardless | ||
| json.showMcqAnswer !@assessment.allow_partial_submission || @assessment.show_mcq_answer | ||
| json.showEvaluation @assessment.show_evaluation | ||
| json.blockStudentViewingAfterSubmitted @assessment.block_student_viewing_after_submitted |
There was a problem hiding this comment.
I believe this can share logic with the existing isSubmissionBlocked flag, since they should be controlled by the same configuration?
Also, the JSON key can be renamed to isSubmissionBlocked to align with existing logic.

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 checkscourse_user.student?. Instructors are never students, so the block is never triggered — even in student view mode.Fix
Backend (
edit.json.jbuilder):blockStudentViewingAfterSubmittedin the assessment JSON so the frontend knows the setting is enabledFrontend (
SubmissionEditIndex):graderView: false), check if the submission would be blocked (not attempting, not published, setting enabled)<BlockedSubmission />in place of the submission contentNot changed