Skip to content

Memo engagement UI (endorse / critique) with LinkedIn sign-in#37

Merged
xrendan merged 6 commits into
mainfrom
feature/memo-engagement-users
Jul 21, 2026
Merged

Memo engagement UI (endorse / critique) with LinkedIn sign-in#37
xrendan merged 6 commits into
mainfrom
feature/memo-engagement-users

Conversation

@xrendan

@xrendan xrendan commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

Frontend for reader memo engagement. Readers sign in through York Factory's OAuth (LinkedIn) and can endorse or critique a memo from its page. Pairs with the York Factory PR of the same branch name (BuildCanada/york_factory#74).

How it works

  • Sign-in: "Endorse / Critique this memo" bounces unauthenticated readers through /api/auth/login → York Factory /oauth/authorize (LinkedIn) → back to /api/auth/callback, which exchanges the code for tokens stored as httpOnly cookies.
  • Identity: getCurrentUser resolves the signed-in reader from York Factory /me (React.cache-deduped per request, never cross-request).
  • Writes: client posts to server-side proxy routes (/api/memos/[slug]/engagement, /api/profile/postal) which forward to York Factory with the Bearer token — the token never reaches the browser.
  • Postal gate: endorsing collects a Canadian postal code when the account isn't engagement-ready yet.
  • Cache: /api/revalidate busts the memo's ISR cache when counts change (shared REVALIDATE_SECRET).

Next.js 16 fix (second commit)

Next 16 renamed the edge entrypoint middleware.tsproxy.ts and refuses to boot with both present. This branch had both, with different logic (proxy = PostHog /dashboard gating, middleware = OAuth token refresh). Merged into a single proxy() that dispatches by path and unions the matchers, and deleted middleware.ts.

Testing

Verified the full loop live against a local York Factory (this branch): sign in with LinkedIn → return authenticated → "Endorse this memo" saves the postal code and writes a real endorsement (POST /api/memos/…/engagement201), engagement count updates. Lint clean on changed files.

jnmclarty and others added 6 commits July 20, 2026 20:43
Evolves jnmclarty's frontend from the direct LinkedIn-payload approach to real
OAuth: readers sign in through York Factory's Doorkeeper (LinkedIn), tokens live
in httpOnly cookies, and engagement writes go through server-side proxy routes
(/api/memos/[slug]/engagement, /api/profile/postal) with the Bearer token kept
off the client. Adds getCurrentUser resolving the reader from /me, the postal-
code profile step when an account isn't engagement-ready, and /api/revalidate
ISR cache-busting.
@xrendan
xrendan force-pushed the feature/memo-engagement-users branch from 5bfc1fa to 6985db8 Compare July 21, 2026 02:43
@xrendan
xrendan merged commit b894372 into main Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants