-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Ready for Review] Fix Helpful Reviews #377
Conversation
- supports optional query parameter to filter by status - by default it will not filter by status - add documentation for review/like/:userId
- simplified update process - removed useState for reviewData so changes to originally passed prop review will update on the component. - added helpful icon - ensure color of icon updated when liked
- adds query term for APPROVED - delete from the list locally when it is disliked
- update pending reviews locally when like changes
[diff-counting] Significant lines: 249. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The like/helpful review functionality is robust and works well on each page.
I like the implementation of the design which makes the functionality more intuitive.
There is an edge case in the /api/review/like/:userId
endpoint where a user with an existing likes document but no actual likes (so empty document) will trigger a Firestore error:
Error: Invalid Query. A non-empty array is required for 'in' filters.
Suggested fix is adding to backend/src/app.ts:184-187
:
if (reviewIds.length === 0) { res.status(200).send(JSON.stringify([])); return; }
This fix handles the empty like situation by returning an empty array, which is the same behavior as if the user does not have an existing document.
I have resolved and fixed the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on this PR, this has been a bug in our codebase for a while so thanks for fixing it! Also, the updated helpful reviews button helps us match the site to the CU Apts design system for consistency so good job with that too.
Summary
This pull request resolves front-end and back-end issues with marking reviews as helpful. The most important changes include updating the backend API endpoint for fetching liked reviews, adding a new icon for helpful reviews on the frontend, and refactoring the frontend components to handle review data more efficiently.
Checklist
Changes
Backend Changes:
backend/src/app.ts
)Frontend Changes:
Review Component Enhancements:
HelpfulIcon
for displaying the helpfulness of reviews. (frontend/src/components/Review/Review.tsx
) [1] [2] [3]ReviewComponent
to directly use thereview
prop instead of maintaining a separate state forreviewData
. (frontend/src/components/Review/Review.tsx
) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]Page Component Updates:
frontend/src/pages/ApartmentPage.tsx
) [1] (frontend/src/pages/BookmarksPage.tsx
) [2] [3] [4] (frontend/src/pages/LandlordPage.tsx
) [5] (frontend/src/pages/ProfilePage.tsx
) [6]Test Plan
Tested using Postman and end-to-end user testing. I tested the API endpoint to ensure it returns correctly and is called correctly on all pages. I tried testing while logged in and while not logged in, liking it before and after, and spam clicking.
(Not marked helpful)
(Marked helpful)
Notes