feat(notifications): node-config-style channel manager + lock disabled-channel opt-in
Settings → 通知 now mirrors the node-config UX: info-only channel cards (name / id / url / template + an inline enable toggle), create + edit via a dialog, and all changes debounced-auto-save (no save button). The save path is generation-guarded so a superseded in-flight save can't clobber a newer edit; the test action flushes the pending save first so it never hits an unsaved channel. The channel id is locked while editing to keep per-account channelIds references from orphaning. Per-account opt-in: a globally-disabled channel's toggle is now locked + forced off (it can never fire). The id is kept in channelIds — the backend already filters disabled channels — so re-enabling globally restores the prior selection. New: notification-channel-dialog.tsx. webui typecheck + build green. Adversarial review: 0 blockers / 0 should-fix (2 nits applied).
This commit is contained in:
3 files changed
+390
-175
No files matched your search
@@ -71,9 +71,12 @@ export function NotificationOptIn({ selectedIds, onChange }: NotificationOptInPr
|
||||
<p className="truncate text-[11px] text-muted-foreground">{ch.url}</p>
|
||||
</div>
|
||||
<ToggleSwitch
|
||||
value={selected.has(ch.id)}
|
||||
// Globally-disabled channel: lock the switch and force it off
|
||||
// (it can never fire, so the per-account opt-in must read off).
|
||||
value={ch.enabled && selected.has(ch.id)}
|
||||
onChange={(v) => toggle(ch.id, v)}
|
||||
ariaLabel={`为该账号启用渠道 ${ch.name || ch.id}`}
|
||||
disabled={!ch.enabled}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user