Fix/no review user email in frontend#195
Merged
PrinceBashangezi merged 4 commits intomainfrom Apr 15, 2026
Merged
Conversation
…to include ownership status. Updated response structure to indicate if the user is the owner of the review. Modified frontend components to utilize the new ownership flag for conditional rendering instead of user email.
…pdated response structure to return a safe version of reviews, stripping author identity from anonymous reviews. Modified frontend components to utilize the new ownership flag for user review checks.
…both MongoDB ObjectIds are converted to strings for accurate comparison.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cjuyematsu
reviewed
Apr 15, 2026
cjuyematsu
reviewed
Apr 15, 2026
cjuyematsu
approved these changes
Apr 15, 2026
Collaborator
cjuyematsu
left a comment
There was a problem hiding this comment.
I think just the isAuthenticated guard is needed, looks good other than that
…view type to enforce ownership status.
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.
Context
- JIRA ASPC 83
authenticated user to see other reviewers' email addresses via browser DevTools
Describe your changes
Backend
each document, and replace it with isOwner computed from req.session.user.email
/:buildingId/:roomNumber/reviews)
user's MongoDB _id from the session, adds isOwner per review, and sets author: null for anonymous reviews so
the author's name cannot be recovered from the network response
was always true because user._id was never stringified — edit/delete of event reviews was broken for all users
Frontend
isOwner: boolean; adds EventReviewAuthor interface (no email field)
review.user_email comparisons with review.isOwner
longer accepts or uses email
author.email to user.email
Security model
Ownership checks for PATCH/DELETE (in isCourseReviewOwner, isHousingReviewOwner, isEventReviewOwner) are
unchanged — they compare session data against the database and were never client-influenced. The isOwner flag
in GET responses is for UI only; the backend enforces actual authorization independently.
Testing
No automated tests exist for these routes yet. Manual test plan:
As review owner
no user_email field
was broken before due to the ObjectId comparison bug)
As a different user
false and no user_email field
Anonymous event reviews
buttons
DevTools check (core regression test)
anywhere in the review objects