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
+29 -5
View File
@@ -21,6 +21,7 @@ import { CSS } from "@dnd-kit/utilities";
import { api, getActiveAccount, type FeedFilters, type SavedView } from "../lib/api";
import { filtersToParams, shareUrl } from "../lib/urlState";
import { notify } from "../lib/notifications";
import { notifyActionError } from "../lib/actionErrors";
import { copyText } from "../lib/clipboard";
import { accountKey, LS, writeJSON } from "../lib/storage";
import { useConfirm } from "./ConfirmProvider";
@@ -78,21 +79,34 @@ export default function SavedViewsWidget({
if (!name) return;
// Strip the transient shuffle seed so a saved "shuffle" view re-rolls fresh on apply.
const { seed: _seed, ...clean } = filters;
await api.createView(name, clean);
setNaming(false);
setDraftName("");
try {
await api.createView(name, clean);
} catch (e) {
notifyActionError(e, t("views.actionFailed"));
}
refresh();
}
async function rename(id: number, name: string) {
const next = name.trim();
if (next) await api.updateView(id, { name: next });
setRenameId(null);
if (!next) return;
try {
await api.updateView(id, { name: next });
} catch (e) {
notifyActionError(e, t("views.actionFailed"));
}
refresh();
}
async function toggleDefault(v: SavedView) {
await api.updateView(v.id, { is_default: !v.is_default });
try {
await api.updateView(v.id, { is_default: !v.is_default });
} catch (e) {
notifyActionError(e, t("views.actionFailed"));
}
refresh();
}
@@ -103,7 +117,11 @@ export default function SavedViewsWidget({
danger: true,
});
if (!ok) return;
await api.deleteView(v.id);
try {
await api.deleteView(v.id);
} catch (e) {
notifyActionError(e, t("views.actionFailed"));
}
refresh();
}
@@ -128,7 +146,13 @@ export default function SavedViewsWidget({
qk.savedViews(),
next.map((id) => views.find((v) => v.id === id)!),
);
await api.reorderViews(next);
// On failure the refetch below reverts the optimistic order to the server's truth; without the
// toast the drop would silently snap back with no explanation.
try {
await api.reorderViews(next);
} catch (e) {
notifyActionError(e, t("views.reorderFailed"));
}
refresh();
}