Fix signed-in community discussions and votes failing with 401 - #63
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Signed-in discussion create and votes already require verifyUserRequest, but the community page posted without a Bearer token so every signed-in user got 401. Also render the votes route dynamically so Authorization headers are available. Co-authored-by: Andy Oliver Rozario <andyrozario7@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
What changed
fetchWithFirebaseAuthRequired.force-dynamicsoAuthorizationheaders are available instead of being stripped by static rendering.guestPost: true) is unchanged and stays captcha-gated.Why this change is safe
POST /api/community/discussions(signed-in path) andGET/POST /api/community/votesalready callverifyUserRequest. The community page used plainfetch()with no Bearer token, so every signed-in user received 401. Votes was alsoforce-static./community/attribution→ create a discussion or upvote a thread → 401 toast; optimistic vote UI rolls back.dynamic+ a source-lock unit test).Verification
pnpm exec eslinton touched files (0 errors; pre-existing warnings only)pnpm test— 70 suites / 384 tests passedpnpm run lint:securitypassedRegression prevention
tests/unit/community-signed-in-writes-auth.test.ts(fails if signed-in discussion/vote fetches drop Bearer, or votes revert toforce-static).fetchwithguestPost: true.Release checklist (solo-friendly)
CI / Lint + JestCI / Playwright smokemain.