fix(notifications): a notice keeps what to say and says it in the reader's language when shown

This commit is contained in:
2026-10-29 22:37:14 +01:00
parent 6986eb1937
commit 4ef772d37b
125 changed files with 973 additions and 674 deletions
+4 -4
View File
@@ -1,16 +1,16 @@
import { HttpError } from "./api";
import { markReported } from "./api/core";
import { notify } from "./notifications";
import { msg, notify, type NotifText } 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
// granted the write scope — surface a "Connect" affordance instead of a vague failure. Pass
// `onConnect` to offer the connect-wizard button (callers that have no wizard handle, e.g. the
// channel page, just get the message). `fallbackMessage` is the already-translated non-403 error.
// channel page, just get the message). `fallbackMessage` is what a non-403 error says.
export function notifyYouTubeActionError(
err: unknown,
fallbackMessage: string,
fallbackMessage: NotifText,
onConnect?: () => void,
): void {
const httpErr = err instanceof HttpError ? err : null;
@@ -18,7 +18,7 @@ export function notifyYouTubeActionError(
// A 403 on a YouTube write action means the write scope isn't granted — offer to connect.
notify({
level: "error",
message: i18n.t("channels.notify.needYouTube"),
message: msg("channels.notify.needYouTube"),
action: onConnect
? { label: i18n.t("channels.notify.connect"), onClick: onConnect }
: undefined,