CodeForPhilly / CodeForPhilly/codeforphilly-ng

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

Ouverte
#39 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
1
Forks
1
Merge moyen
5 j 3 h
PR mergées (30 j)
9

Description

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)

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.