Skip to content

STORY-142: Reading list (Save for later) UI - #83

Closed
devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/story-142-reading-list
Closed

devin-ai-integration[bot] wants to merge 3 commits into
mainfrom
devin/story-142-reading-list

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Story

STORY-142: Reading list (save articles for later). A logged-in reader can save articles to a private reading list and come back to them later, without making them public favorites.

Acceptance criteria this PR covers:

  1. Article page: logged-in users get a 🔖 Save toggle next to Favorite. Saving switches it to a filled amber 🔖 Saved, and clicking again removes the save.
  2. Anonymous users: clicking Save sends them to /login, not /register like Favorite does.
  3. Own profile: a new Reading list tab lists saved articles, newest saved first (the backend orders them). The tab is hidden on other users' profiles and for anonymous visitors. Visiting /profile/<someone-else>/reading-list directly redirects to /profile/<someone-else> and makes no bookmark request.
  4. Un-saving from the Reading list: the card disappears right away. The empty state reads exactly Nothing saved yet. Use 🔖 Save on any article.
  5. Privacy: no save count is shown anywhere.

What changed

  • Article model: added bookmarked?: boolean. It is optional so backends that don't send it still work; a missing value counts as not saved.
  • ArticlesService: added bookmark(slug), unbookmark(slug) (both return Article) and queryBookmarked({limit, offset}).
  • New BookmarkButtonComponent (features/article/components/bookmark-button.component.ts), built on the same pattern as FavoriteButtonComponent (isSubmitting signal, UserService.isAuthenticated check, toggle output emitting the new state). Unsaved uses a btn-outline-bookmark class and saved uses a filled btn-bookmark class (#f0ad4e, white text). Both classes live in the component's styles, so the theme is untouched. It is btn-sm like the other buttons.
  • article.component.html: added <app-bookmark-button> after app-favorite-button in both article-meta blocks (banner and below the body). Article authors also get it, placed after Edit/Delete in the canModify() branch. onToggleBookmark updates the article signal. The Follow/Favorite labels are unchanged.
  • New ProfileReadingListComponent plus a reading-list child route in profile.routes.ts:
    • It waits until authState is no longer loading, then checks that the route username is the current user. If not, it redirects with replaceUrl to /profile/<username>.
    • Each card shows author · date, a title linking to the article, the description, and a 🔖 Saved button. There is no favorite heart or count on these cards.
    • Pagination appears when articlesCount > 10, the same page size as the other profile tabs. Un-saving the last card on a page recomputes the page count, and if other saves remain it moves to the last valid page and reloads it. The empty state only shows when there are no saves at all.
  • profile.component.html: a third tab, Reading list, wrapped in @if (isUser()). The existing "My Posts" / "Favorited Posts" labels are unchanged.
  • Non-feature change, needed to run the unit tests: added zone.js (~0.16.0) as a devDependency. On main, every spec imports zone.js, but the "zoneless" commit removed it from package.json. As a result, bun run test -- --run failed on main with Failed to resolve import "zone.js" (6 of 6 files failing, 0 tests run). Running bun install also synced bun.lock's stale @angular/core entry to the 21.2.4 that package.json already pins.
  • Design-fidelity tweaks after the end-to-end run (68268df): reading list cards show author · date inline in grey; the active Reading list tab text is amber (.reading-list-tab, scoped to the profile component); the outline Save is amber only on :hover, not :focus, so it doesn't look saved after an un-save.
  • api.interceptor.ts is not changed.

API contract consumed

The backend serves at the root path, and api.interceptor adds the base URL.

  • POST /articles/{slug}/bookmark → { article } (bookmarked: true)
  • DELETE /articles/{slug}/bookmark → { article } (bookmarked: false)
  • GET /articles/bookmarked?limit=10&offset=N → { articles, articlesCount }, the current user's bookmarks only, newest saved first
  • Every Article gains bookmarked: boolean. There is no bookmark count anywhere. Auth uses the existing Authorization: Token <jwt> header.

Test results

New specs:

  • bookmark-button.component.spec.ts (7 tests): Save/Saved labels and classes, POST/DELETE, emit, error path, anonymous → /login with no HTTP call.
  • profile-reading-list.component.spec.ts (7 tests): cards, exact empty state, un-save removes the card, pagination, going back a page after un-saving the only card on the last page, redirect for another user's profile and for anonymous users.
  • profile.component.spec.ts (3 tests): the tab shows only on your own profile.
  • articles.service.spec.ts: 4 new tests for bookmark, unbookmark and queryBookmarked.
$ bun run test -- --run
 Test Files  9 passed (9)
      Tests  201 passed (201)

$ bun run format:check
All matched files use Prettier code style!

$ bun run build
Application bundle generation complete.

The Playwright e2e suites were not run locally; CI runs them on this PR.

End-to-end verification against the real backend

Ran locally: the backend from COG-GTM/spring-boot-realworld-example-app#1202 (bootRun, JDK 11, SQLite, :8080) and this app (:4200), with api.interceptor.ts pointed at http://localhost:8080 only for the run (not committed; restored after). Two users, ana and bob:

  • AC1: outline 🔖 Save → filled amber 🔖 Saved → back to Save. The state persists across reload, and Follow/Favorite are unchanged.
  • AC2: anonymous Save → /login.
  • AC3: ana's Reading list tab lists her saves newest first. It is hidden on other profiles.
  • AC4: un-saving removes the card. Removing all of them shows exactly Nothing saved yet. Use 🔖 Save on any article., which persists after reload.
  • AC5: bob sees no Reading list tab on ana's profile, and opening /profile/ana/reading-list directly redirects to ana's public profile. Bob's own list is empty, and no save count appears anywhere.
  • AC6: curl checks of POST/DELETE/GET shapes, pagination, per-user isolation, and 401 without a token all pass (see the backend PR).

Known visual differences from the design that are outside this story: the app-wide article banner is white (the repo theme's .banner), and default avatars from the external image host didn't load in the test environment. The active tab's underline is still the theme green; only the text is amber.

Related

Screenshots

Frame 1: article, Saved Frame 2: own Reading list
Frame 1 Frame 2
Empty state Other user's profile (no tab)
Empty Other profile

Walkthrough recording (4 fps):

E2E walkthrough

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/545bdc3ad8b44f1aa50622bfb619a654
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/545bdc3ad8b44f1aa50622bfb619a654?variant=devin


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Enable auto-review to review your pull requests automatically.

Devin Review (Staging)


Devin Review

Add bookmark toggle on the article page, a private Reading list tab on
your own profile, and ArticlesService bookmark/unbookmark/queryBookmarked.
Add zone.js devDependency so the existing vitest suite can run.

Co-Authored-By: Pedro Tabio <paltat@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@socket-security

socket-security Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​angular/​core@​21.1.1 ⏵ 21.2.481 -1875 +1579 +198 +2100

View full report

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration Bot and others added 2 commits October 28, 2026 18:30
…or authors

Co-Authored-By: Pedro Tabio <paltat@gmail.com>
…ive tab, no amber on blurred Save focus)

Co-Authored-By: Pedro Tabio <paltat@gmail.com>
@devin-ai-integration

devin-ai-integration Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Author

Ran an end-to-end test of 68268df against the real backend from COG-GTM/spring-boot-realworld-example-app#1202 (local, two users ana and bob). All STORY-142 acceptance criteria passed. Privacy and redirect evidence is below; the frame screenshots and walkthrough are in the PR description.

Bob opens /profile/ana/reading-list (redirected, no saves shown) Bob's own list (isolated, empty) Anonymous Save → /login
redirect bob list login

E2E walkthrough

CI test (Playwright) failure is not caused by this PR: the same 6 e2e/settings.spec.ts "Profile Updates" tests fail in the same way on unrelated PRs (e.g. run 38289516365). In those tests the live api.realworld.show returns 422 on PUT /user. Every other spec passes (113 passed, 3 flaky).

Written by Devin

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.

0 participants