CodeForPhilly / CodeForPhilly/codeforphilly-ng

Surface newsletter state on /api/auth/me (or self GET /api/people/:slug)

Aperta
#39 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
1
Fork
1
Merge medio
5g 3h
PR unite (30g)
9

Descrizione

Follow-up from [#38](https://github.com/CodeForPhilly/codeforphilly-ng/pull/38) (authoring-screens).

The Account settings screen has a working newsletter toggle that PATCHes `/api/people/:slug/newsletter`, but the read side never exposes the current opt-in state to the SPA. `GET /api/auth/me` returns the public Person shape (no newsletter); the people serializer hides newsletter from non-self callers.

Result: the Account screen defaults to `optedIn=false` and only reflects the server state after the user toggles once. That's a UX bug — a user who opted-in on a previous session sees a checkbox that lies until they touch it.

### Fix

Add `newsletter.optedIn` (and probably `email`) to the self-view of `GET /api/auth/me` (and/or `GET /api/people/:slug` for self). The `PATCH /api/people/:slug/newsletter` response already returns the full `newsletter` shape, so the data is available — the serializer just needs to include it for self.

### References

- [specs/screens/account.md](../specs/screens/account.md) — Newsletter card spec
- [specs/api/auth.md#get-apiauthme](../specs/api/auth.md) — "The PersonResponse for self includes `email` (fetched from PrivateProfile) and `newsletter` state." (already in the spec; just unimplemented)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.