Conversation
Aman-Cool
requested changes
Apr 20, 2026
Owner
There was a problem hiding this comment.
hey @Ashusf90; Thanks for picking this up! The direction is right but there are two problems that need fixing before this can merge.
Bug - typo introduces a regression
In posts.js, the like-toggle route has a typo:
// line ~63 — POST /:id/like
const userId = req.user.aub; // ← should be req.user.subreq.user.aub is undefined, so:
(p.likes || []).includes(undefined)always returnsfalse— thelikedflag is always wrong- The likes array gets
undefinedpushed into it and written back to the DB, corrupting stored data
Incomplete - symptoms.js and bookings.js not updated
The issue listed four files with the inconsistency. This PR only touches posts.js. The following files still use req.user.id and need the same change:
server/src/routes/symptoms.jsserver/src/routes/bookings.js
(users.js already used req.user.sub so that one is fine.)
Once those two things are fixed this looks good to merge. Happy to re-review quickly.
Aman-Cool
self-requested a review
May 25, 2026 13:14
Owner
|
@Ashusf90, any updates? |
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.
Description
This PR resolves inconsistency in how user IDs are accessed across different routes.
Changes Made
req.user.idwithreq.user.subsub) across:Why This Change
subis the standard JWT claim for user identityidis not mapped in middlewareCloses #7