From be3253415faaa90ed0cf22c51c03ec9f30f0ffed Mon Sep 17 00:00:00 2001 From: npeter83 Date: Fri, 12 Jun 2026 02:29:10 +0200 Subject: [PATCH] fix(channels): reflect shared deep-queue state in the full-history chip deep_requested is per-subscription, but deep backfill is channel-wide and shared: once any subscriber requests full history, the whole back-catalog arrives for everyone. The chip only looked at the current user's flag, so a second subscriber saw a misleading 'get full history' on a channel already queued by someone else. Add a channel-level deep_in_queue to /api/channels and show an informational 'full history queued' badge (vs the owner's cancelable button) in that case. --- backend/app/routes/channels.py | 17 ++++++++++++++ frontend/src/components/Channels.tsx | 35 +++++++++++++++++----------- frontend/src/lib/api.ts | 1 + 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/backend/app/routes/channels.py b/backend/app/routes/channels.py index d458670..b99bac7 100644 --- a/backend/app/routes/channels.py +++ b/backend/app/routes/channels.py @@ -36,6 +36,22 @@ def list_channels( ).all(): stored[cid] = count + # Channels already in the *global* deep-backfill queue — i.e. at least one user (any + # user) has requested full history and it isn't done yet. Their whole back-catalogue is + # coming for everyone (video data is shared), so the UI shouldn't offer "get full + # history" to a user who simply hasn't personally opted in. + deep_queued: set[str] = set() + if channel_ids: + for (cid,) in db.execute( + select(Subscription.channel_id) + .where( + Subscription.channel_id.in_(channel_ids), + Subscription.deep_requested.is_(True), + ) + .distinct() + ).all(): + deep_queued.add(cid) + # The user's personal tag links, grouped by channel. tags_by_channel: dict[str, list[int]] = {} for cid, tag_id in db.execute( @@ -57,6 +73,7 @@ def list_channels( "priority": sub.priority, "hidden": sub.hidden, "deep_requested": sub.deep_requested, + "deep_in_queue": ch.id in deep_queued and not ch.backfill_done, "tag_ids": tags_by_channel.get(ch.id, []), "details_synced": ch.details_synced_at is not None, "recent_synced": ch.recent_synced_at is not None, diff --git a/frontend/src/components/Channels.tsx b/frontend/src/components/Channels.tsx index d27bba0..ea073b6 100644 --- a/frontend/src/components/Channels.tsx +++ b/frontend/src/components/Channels.tsx @@ -354,24 +354,31 @@ function ChannelRow({ /> {c.backfill_done ? ( - ) : ( - + ) : c.deep_requested ? ( + + + ) : c.deep_in_queue ? ( + + + + full history queued + + + ) : ( + + )} diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index cf50bcb..bf693dd 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -176,6 +176,7 @@ export interface ManagedChannel { priority: number; hidden: boolean; deep_requested: boolean; + deep_in_queue: boolean; tag_ids: number[]; details_synced: boolean; recent_synced: boolean;