feat(geschichten): show blog writers' own drafts on the Geschichten overview (#807) #813
Reference in New Issue
Block a user
Delete Branch "feat/issue-807-drafts-overview"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #807.
Why this PR exists (again)
The #807 implementation was completed on
feat/issue-807-drafts-overviewon top of the lesereisen integration branch, but the branch was never pushed or merged — the lesereisen squash (b33d0eb8) landed without it, and the issue was closed anyway. This PR rebases the original 9 commits onto currentmainand adds the one specced item the original implementation missed.Security fix — CWE-639 (broken access control)
GeschichteService.list()forwarded anullstatus straight to the repository forBLOG_WRITEusers, returning all stories from all authors including other writers' DRAFTs. Nownullalways resolves toPUBLISHED; only an explicitstatus=DRAFTrequest (blog writers only) returns drafts, scoped to the caller's own. The two false-safety-net tests that asserted the vulnerable behaviour were rewritten into real regression fixtures (eq(...)argument verification,@DisplayName("security: ...")).Feature
/geschichten, showing their own drafts unfiltered (separate from the filtered published list), with an(alle Entwürfe)captionPromise.allSettledand degrades gracefully todrafts: []— the overview never 500s on a drafts-fetch failuresettled<T>()extracted to$lib/shared/server/settled.tsand reused by both the home and geschichten loadersRebase conflict resolutions (vs. the original branch)
+page.server.ts: combined the drafts fetch with main's documentFilter title resolution (from #803) in onePromise.allSettledwith fixed-position placeholders instead of slice-offset arithmeticpage.server.test.ts: kept main's richermockApi(path-keyed), took the newcallLoad(url, parentData)signaturemessages/*.json: kept both key sets (#803 chip keys + #807 draft keys)New on top of the original branch
The original implementation skipped the spec's gated "Veröffentlicht" heading (the i18n key existed but was unused). Added via red/green TDD as the final two commits.
Verification
GeschichteServiceTest: 45/45 pass (includes the 2 new security regression tests)page.server.test.ts: 16/16 passpage.svelte.spec.ts+GeschichteListRow.svelte.spec.ts: 25 + 12 passsvelte-check: no errors in any touched file (baseline errors in untouched home/admin specs remain)🤖 Generated with Claude Code
list_with_null_status_and_BLOG_WRITE_returns_PUBLISHED_not_all_stories was byte-for-byte identical to the @DisplayName("security: ...") variant; keep the named one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>