CodeForPhilly / CodeForPhilly/codeforphilly-ng

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

未关闭 适合新手
#39 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
1
派生
1
平均合并
5 天 3 小时
30 天内合并 PR
9

描述

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)

贡献指南

这个仓库没有索引到贡献指南

调研方向

先从 specs/api/auth.md#get-apiauthme 和 specs/screens/account.md 开始,然后追踪 GET /api/auth/me 和 GET /api/people/:slug 的 self view 所使用的 serializer。当 self response 包含 newsletter.optedIn 和 email,并且与文档记录的 PersonResponse 以及 newsletter PATCH response shape 一致时,此更改就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
api, backend
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
基本清楚
新手友好度
72/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。