Skip to content

Hide chat messages for student if teacher flags#72264

Open
fisher-alice wants to merge 14 commits intostagingfrom
alice/teacher-flagged-hide
Open

Hide chat messages for student if teacher flags#72264
fisher-alice wants to merge 14 commits intostagingfrom
alice/teacher-flagged-hide

Conversation

@fisher-alice
Copy link
Copy Markdown
Contributor

@fisher-alice fisher-alice commented Apr 21, 2026

The feature to allow teachers to flag messages in the teacher view of their student's chat history was added in #62797.
This PR updates student view of the the student chat history so that if a message is flagged by the teacher, the message is hidden from the student.

There were 5561438 chat events from the last 90 days (as of April 21), and only 47 of them included teacher feedback spreadsheet. Here's a graph of the breakdown of teacher feedback of these events:

Screenshot 2026-04-21 at 9 41 15 PM

For both user and assistant messages that are flagged with 'clean_disagree', the following is displayed: 'This message has been flagged as inappropriate by the teacher.' Note that if a message is text + image or just an image, the same message is displayed.

This PR includes computing teacherFlaggedHidden to determine the display and corresponding UI for teacher-flagged message. I added a couple helper function getHeader and getFooter in ChatMessageView to help readability.

Links

Testing story

Tested locally on a teacher account and a student account who's in the teacher's section.

Screencast of teacher flagging/unflagging messages in Web Lab 2's AI Tutor:

weblab2.mp4

Screencast of teacher flagging/unflagging messages in AI

aichat.mp4

Chat Lab:

Deployment notes

Privacy and security

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds client-side hiding of teacher-flagged chat messages for students by deriving a teacherFlaggedHidden state from teacher feedback and using it to alter message display, styling, and UI chrome.

Changes:

  • Compute teacherFlaggedHidden in ChatEventView based on teacherFeedback === CLEAN_DISAGREE and !isTeacherView, and pass it through to message rendering.
  • Update ChatMessageView to accept isTeacherView + teacherFlaggedHidden, hide assets/footers when hidden, and adjust message style accordingly.
  • Refactor footer selection logic into a helper (getFooter) and extend getChatMessageDisplayText/getMessageStyle to account for hidden messages.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
apps/src/aichat/views/ChatMessageView.tsx Uses teacherFlaggedHidden to suppress visibility-dependent UI and change the rendered message text/style; refactors footer logic.
apps/src/aichat/views/ChatEventView.tsx Derives teacherFlaggedHidden from teacher feedback and supplies it to aria-label + ChatMessageView.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/src/aichat/views/ChatMessageView.tsx
Comment thread apps/src/aichat/views/ChatMessageView.tsx Outdated
Comment thread apps/src/aichat/views/ChatMessageView.tsx
Comment thread apps/src/aichat/views/ChatEventView.tsx
@fisher-alice fisher-alice marked this pull request as ready for review April 21, 2026 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants