Skip to content

FE_13 - Instructor Anonymity Toggle for Projected/Presenter View #74

Description

@notjackl3

Summary

Add a toggle in the instructor/professor room view to show or hide student identities, so names can be safely hidden while questions and slides are projected on a classroom screen.
[Estimated hours: 3-4]

Objectives

  • Add an "Anonymous mode" / "Hide names" toggle to the instructor view (PROFESSOR and TA)
  • When enabled, suppress all author names, role icons, and reveal info in the rendered question/answer list
  • When disabled, restore the normal instructor view (real authors visible, including revealed anonymous authors)
  • Default the toggle to ON (hidden) so projecting is safe by default
  • Persist the choice per instructor (localStorage) so it survives refresh during a lecture

Description

Instructors often project the slides and live Q&A on the classroom screen (e.g. CSC209 lectures). Today the instructor view always shows the real author of a question — including authors revealed via the question:author:revealed socket event — which leaks student names to the whole room and contradicts the point of anonymous questions.

This ticket adds a single client-side toggle in the instructor view that hides all identifying info from the rendered list, turning the instructor's screen into a "projection-safe" view without changing what data the instructor could otherwise see. Flipping it back instantly restores names for private grading/triage.

User Flow

Professor/TA opens the room view
     → Toggle "Hide names (projection mode)" is ON by default
     → All questions/answers render with authors hidden (no name, no role icon, no utorid)
     → Professor projects screen safely
     → Professor flips toggle OFF on their own laptop later
     → Real authors (incl. revealed anonymous authors) appear again
     → Choice persists across refresh (localStorage)

Technical Details

Affected Files

src/app/room/classChat/
├── ChatHeader.tsx                # Add toggle control (render only for PROFESSOR/TA)
├── index.tsx                     # Hold `projectionMode` state, gate author data passed down,
│                                 #   persist to localStorage
└── post/
    ├── PostUtils.tsx             # renderUsername()/renderRoleIcon() respect projectionMode
    ├── QuestionPost.tsx          # Pass projectionMode into renderUsername()
    └── index.tsx                 # Pass projectionMode through to answer rendering

Implementation Notes

  • Role is already known in the room via /api/sessions/{sessionId}/my-role; only render the toggle when role is TA or PROFESSOR.
  • Reuse the existing renderUsername() / renderRoleIcon() helpers in PostUtils.tsx. When projectionMode is on, render the same anonymized output a student would see (e.g. "Anonymous", no role icon), regardless of isAnonymous or revealed-author state.
  • This is presentation-only: do NOT change socket payloads, the question:author:revealed flow, or what the server sends. The instructor still receives author data; the UI simply does not display it while the toggle is on.
  • Keep this distinct from the per-post isAnonymous flag and the globalIsAnonymous compose toggle (classChat/index.tsx) — those control how a post is submitted; this controls how the instructor views the room.
  • Persist under a stable key, e.g. localStorage["room:projectionMode"].

Acceptance Criteria

  • Toggle is visible only to PROFESSOR and TA roles, not to students
  • Toggle defaults to ON (names hidden) on first load
  • With toggle ON, no question shows author name, utorid, or role icon
  • With toggle ON, answers also hide author name, utorid, and role icon
  • With toggle ON, authors revealed via question:author:revealed are NOT displayed
  • With toggle OFF, the instructor view behaves exactly as before (real authors + revealed authors shown)
  • Toggling does not trigger a refetch or alter socket subscriptions (pure client render change)
  • Toggle state persists across page refresh (localStorage) and is scoped to the instructor's browser
  • Students never see or are affected by this control
  • No author data is logged or rendered to the DOM (even hidden) while the toggle is ON

Notes

  • Future enhancement: make this a persisted per-session setting on the Session model (e.g. defaultProjectionMode) so it applies across an instructor's devices — out of scope here, this ticket is client-side only.
  • Pairs well with the slide viewer panel; consider surfacing the toggle near the presenter/slide controls in a follow-up.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions