diff --git a/static/account.js b/static/account.js index a443ae7..6ca83fa 100644 --- a/static/account.js +++ b/static/account.js @@ -302,7 +302,8 @@ function renderHeader() { @@ -338,6 +339,15 @@ function renderHeader() { await refreshUser(); emitAuth(); // repaint the popover in its unlinked state }); + const dmBtn = el.querySelector(".acct-discord-dm"); + if (dmBtn) dmBtn.addEventListener("click", async () => { + dmBtn.disabled = true; + try { + await apiFetch("api/v2/discord/dm", { method: "POST", json: { enabled: !currentUser.discord_dm } }); + } catch (e) {} + await refreshUser(); + emitAuth(); // repaint with the new on/off label + }); paintBadge(); paintNotifList(); startNotifPolling();