Skip to content

feat: persist chat read/unread state (server-backed) #472

Description

@bjrump

Context

Split out from #469 (finding 9). Today an "unread" state for chats exists client-side only: AppSidebar keeps an in-memory hasUnreadUpdate flag (manuallyUnreadChatIds / unreadChatIds) and renders a blue dot. There is no DB column, no API, no fetch — so the state is lost on reload and never syncs across sessions/devices.

#469 only adds an immediate cosmetic fix (the chat menu item now toggles between "Als ungelesen markieren" and "Als gelesen markieren"). This issue tracks the real feature.

Two concepts, one indicator

The current dot conflates two distinct ideas that a persisted model should keep separate:

  • Manual unread — a user-asserted state ("mark as unread").
  • New activity / background update — a system-detected change while the chat wasn't active.

Scope

  • DB: add read-tracking to the chat model (e.g. last_read_at, or an explicit unread flag).
  • API: endpoints to mark read/unread and to fetch unread state; include unread in chat summary/library contracts.
  • Frontend: drive the sidebar indicator and the menu toggle from server state instead of in-memory refs; survive reload and sync across sessions.
  • Decide whether manual-unread and new-activity are tracked separately or collapsed.

Notes

  • Likely warrants an ADR (new persisted domain concept; the manual-vs-automatic distinction should be reflected in CONTEXT.md).
  • Indicator visibility bug to keep in mind: the dot is currently suppressed on row hover / open menu (group-hover/chat-row:hidden).

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions