diff --git a/web/src/app/AppShell.tsx b/web/src/app/AppShell.tsx index 25b9ab49..4a2796d5 100644 --- a/web/src/app/AppShell.tsx +++ b/web/src/app/AppShell.tsx @@ -15,8 +15,11 @@ import { NavRail } from './NavRail'; export function AppShell() { const contacts = useChatList(); const bootstrap = useBootstrap(); + // "sys"/"slf" have their own authoritative unread source in entry_badges (bootstrap.ts) -- excluded + // here in case they ever also show up as regular Tinode subscriptions in `contacts`, which would + // otherwise double-count the same unread messages into this badge. const unreadMessages = - contacts.reduce((sum, c) => sum + (c.unread || 0), 0) + + contacts.reduce((sum, c) => (c.topic === 'sys' || c.topic === 'slf' ? sum : sum + (c.unread || 0)), 0) + (bootstrap.data?.entry_badges?.system_unread_count || 0) + (bootstrap.data?.entry_badges?.file_assistant_unread_count || 0); diff --git a/web/src/app/NavRail.tsx b/web/src/app/NavRail.tsx index f8fcc5d3..3760659b 100644 --- a/web/src/app/NavRail.tsx +++ b/web/src/app/NavRail.tsx @@ -45,8 +45,8 @@ function NavRailButton({ item }: { item: NavRailItem }) { /** Persistent 64px icon rail, visible at >=640px (see App.tsx for the <640 bottom-tab fallback). */ export function NavRail({ selfInitial = '我', unreadMessages = 0 }: { selfInitial?: string; unreadMessages?: number }) { return ( -