From 9dce0226a01b7dcd8ef98e8b0b32b7052bb86490 Mon Sep 17 00:00:00 2001 From: Osamaali313 Date: Sun, 19 Jul 2026 22:42:58 +0300 Subject: [PATCH] Fix note detail showing "/ 0 (-N remaining)" for unlimited views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the MyUploads TUI note-detail panel, the view counter renders: {liveNote.viewCount} / {liveNote.maxViews} ({liveNote.maxViews - liveNote.viewCount} remaining) `maxViews === 0` means "unlimited" and is the default (server config NOTE_DEFAULT_VIEWS = "0", and the server treats 0 as unlimited). So a default note viewed 3 times shows `Views: 3 / 0 (-3 remaining)` — a nonsensical `/ 0` and a negative "remaining", implying the link is exhausted when it is not. Every other place that renders view counts special-cases 0: the CLI `list` (`maxViews === 0 ? \`${viewCount} / ∞\``), the web `NoteCard`, and the client `note` command (`maxViews === 0 ? "unlimited"`). Mirror them: show ∞ for unlimited and only show the "remaining" hint when there is a finite limit. (The adjacent uploads panel uses the same `max - count` pattern correctly because `maxDownloads` is schema-validated positive and can never be 0.) --- apps/client/src/tui/views/MyUploads.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/client/src/tui/views/MyUploads.tsx b/apps/client/src/tui/views/MyUploads.tsx index 978f0d7..95fdb67 100644 --- a/apps/client/src/tui/views/MyUploads.tsx +++ b/apps/client/src/tui/views/MyUploads.tsx @@ -293,8 +293,10 @@ export function MyUploadsView({ appState, onBack }: MyUploadsViewProps): React.R <> Views: - {liveNote.viewCount} / {liveNote.maxViews} - ({liveNote.maxViews - liveNote.viewCount} remaining) + {liveNote.viewCount} / {liveNote.maxViews === 0 ? "∞" : liveNote.maxViews} + {liveNote.maxViews > 0 && ( + ({liveNote.maxViews - liveNote.viewCount} remaining) + )} Expires: