merge: full-history chip reflects shared deep-queue state
This commit is contained in:
commit
0dad71cf6e
3 changed files with 39 additions and 14 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -354,24 +354,31 @@ function ChannelRow({
|
|||
/>
|
||||
{c.backfill_done ? (
|
||||
<SyncBadge ok label="full" hint="Full history fetched." />
|
||||
) : (
|
||||
<Tooltip
|
||||
hint={
|
||||
c.deep_requested
|
||||
? "Full history requested — this channel's whole back-catalog will backfill as the shared quota allows. Click to cancel the request."
|
||||
: "Only recent uploads so far. Click to request this channel's full back-catalog (older videos + complete search)."
|
||||
}
|
||||
>
|
||||
) : c.deep_requested ? (
|
||||
<Tooltip hint="Full history requested — this channel's whole back-catalog will backfill as the shared quota allows. Click to cancel your request.">
|
||||
<button
|
||||
onClick={onDeep}
|
||||
className={`inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full border transition ${
|
||||
c.deep_requested
|
||||
? "bg-accent text-accent-fg border-accent"
|
||||
: "bg-card border-border text-muted hover:border-accent"
|
||||
}`}
|
||||
className="inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full border border-accent bg-accent text-accent-fg transition"
|
||||
>
|
||||
<History className="w-3 h-3" />
|
||||
{c.deep_requested ? "full history queued" : "get full history"}
|
||||
full history queued
|
||||
</button>
|
||||
</Tooltip>
|
||||
) : c.deep_in_queue ? (
|
||||
<Tooltip hint="Another subscriber already requested this channel's full history, so its whole back-catalog is on its way to everyone — nothing to do here.">
|
||||
<span className="inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full border border-accent/40 text-accent">
|
||||
<History className="w-3 h-3" />
|
||||
full history queued
|
||||
</span>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Tooltip hint="Only recent uploads so far. Click to request this channel's full back-catalog (older videos + complete search).">
|
||||
<button
|
||||
onClick={onDeep}
|
||||
className="inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full border bg-card border-border text-muted hover:border-accent transition"
|
||||
>
|
||||
<History className="w-3 h-3" />
|
||||
get full history
|
||||
</button>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue