feat(ux): R11 feedback symmetry — Plex/download/rollback/deny notices

Give equal-weight actions equal-weight feedback (R11).

S1 Plex error toasts: the watched-toggles (card / season mark-all / episode /
info-panel / show mark-all) used to fail silently on 403/404/429; each now surfaces
the server reason via a shared notifyActionError() + resyncs the optimistic flip.
The playback auto-mark-watched stays intentionally silent (a mid-play toast is
noise; the next sync corrects it). New generic lib/actionErrors.ts (Plex + saved
views reuse it; notifyYouTubeActionError delegates its non-403 case to it).

S2 download-done inbox notification: worker.py emits a best-effort type=download_done
notice to the job owner on real completion (regular + edit jobs, not instant
cache-hits), rendered/localized in the inbox with an Open-Downloads link.

S3 optimistic rollbacks: SavedViewsWidget create/rename/toggle-default/remove/reorder
and the inbox revert-state no longer swallow failures — they toast + refetch to
resync (the reorder's optimistic order reverts to server truth).

S4 access-request deny: deny_invite now emails the requester (send_access_denied),
mirroring approve — no more silent limbo.
This commit is contained in:
2026-08-11 05:05:50 +02:00
parent 354b3dd10c
commit e2fe6fa286
15 changed files with 154 additions and 14 deletions
+14
View File
@@ -0,0 +1,14 @@
import { HttpError } from "./api";
import { notify } from "./notifications";
/**
* Surface a failed write action as an error toast instead of the click silently doing nothing.
* Prefers the server's own reason (`HttpError.detail` — e.g. "Not enough quota left today", a
* 404/429 message) over the caller's already-translated generic fallback. Domain-agnostic: used by
* the Plex watched-toggles and the saved-view ops, and delegated to by `notifyYouTubeActionError`
* for its non-403 case.
*/
export function notifyActionError(err: unknown, fallbackMessage: string): void {
const detail = err instanceof HttpError ? err.detail : null;
notify({ level: "error", message: detail || fallbackMessage });
}
+2 -1
View File
@@ -1,5 +1,6 @@
import { HttpError } from "./api";
import { notify } from "./notifications";
import { notifyActionError } from "./actionErrors";
import i18n from "../i18n";
// A YouTube-gated action (subscribe, sync, backfill, unsubscribe) that 403s means the user hasn't
@@ -25,5 +26,5 @@ export function notifyYouTubeActionError(
}
// Any other error: prefer the server's own reason (e.g. "Not enough quota left today") over the
// caller's generic fallback — the useful detail was being discarded (U-3.2.8).
notify({ level: "error", message: httpErr?.detail || fallbackMessage });
notifyActionError(err, fallbackMessage);
}