Hide chat messages for student if teacher flags#72264
Open
fisher-alice wants to merge 14 commits intostagingfrom
Open
Hide chat messages for student if teacher flags#72264fisher-alice wants to merge 14 commits intostagingfrom
fisher-alice wants to merge 14 commits intostagingfrom
Conversation
Contributor
There was a problem hiding this comment.
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
teacherFlaggedHiddeninChatEventViewbased onteacherFeedback === CLEAN_DISAGREEand!isTeacherView, and pass it through to message rendering. - Update
ChatMessageViewto acceptisTeacherView+teacherFlaggedHidden, hide assets/footers when hidden, and adjust message style accordingly. - Refactor footer selection logic into a helper (
getFooter) and extendgetChatMessageDisplayText/getMessageStyleto 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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
teacherFlaggedHiddento determine the display and corresponding UI for teacher-flagged message. I added a couple helper functiongetHeaderandgetFooterinChatMessageViewto 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