Description
This feature adds highlighting for comments made by users with the "Regular Commenter" achievement badge.
Changes needed:
- Modify the comment retrieval endpoint to check if a commenter has the "Regular Commenter" achievement
- Add a
should_highlight boolean flag to comment data in the API response
- Maintain privacy by not exposing any personal user information
Implementation Details
- In
restaurant_routes.py, modify the /restaurants/<int:restaurant_id>/comments GET endpoint
- For each comment, check if its author has the "Regular Commenter" achievement
- Add a
should_highlight flag to the comment JSON data
- The frontend will use this flag to highlight the comment in the UI
Technical Approach
- Query
UserAchievement table to check if the comment's author has the "Regular Commenter" achievement
- Add the highlight flag to the comment data structure
- Update API documentation to reflect this new field
Benefits
- Enhanced user experience by visually distinguishing comments from experienced users
- Creates a gamification feature that incentivizes users to submit more comments
- Maintains user privacy by not exposing which specific user made which comment
Testing
- Verify that comments from users with the achievement are properly flagged
- Confirm that no PII or user-specific data is leaked in the process
- Test with various combinations of users with and without achievements
Description
This feature adds highlighting for comments made by users with the "Regular Commenter" achievement badge.
Changes needed:
should_highlightboolean flag to comment data in the API responseImplementation Details
restaurant_routes.py, modify the/restaurants/<int:restaurant_id>/commentsGET endpointshould_highlightflag to the comment JSON dataTechnical Approach
UserAchievementtable to check if the comment's author has the "Regular Commenter" achievementBenefits
Testing