From cabe0dbe0c135233255d09e4e2efb6a83e3f26b7 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 18 Jan 2026 23:03:36 -0500 Subject: [PATCH] Remove channel notify control wiring --- js/channelProfile.js | 67 +------------------------------------------- 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/js/channelProfile.js b/js/channelProfile.js index 4c752719..496d60b4 100644 --- a/js/channelProfile.js +++ b/js/channelProfile.js @@ -3333,36 +3333,11 @@ function resolveChannelHexForControls() { return decodeNpubToHex(currentChannelNpub); } -function syncChannelNotifyButtonState(button, channelHex) { - if (!button) { - return; - } - const resolvedHex = normalizeHex(channelHex); - const isSubscribed = - resolvedHex && subscriptions.isSubscribed(resolvedHex) === true; - button.setAttribute("aria-pressed", isSubscribed.toString()); - button.dataset.state = isSubscribed ? "subscribed" : "unsubscribed"; - button.classList.toggle("active", isSubscribed); -} - -function openLoginModalForChannelControls(triggerElement) { - const loginModal = - prepareStaticModal({ id: "loginModal" }) || - document.getElementById("loginModal"); - - if (loginModal && openStaticModal(loginModal, { triggerElement })) { - setGlobalModalState("login", true); - } else { - userLogger.warn("Unable to open login modal for channel controls."); - } -} - function setupChannelMessageControls() { const doc = typeof document !== "undefined" ? document : null; - const notifyBtn = doc?.getElementById("channelNotifyBtn") || null; const messageBtn = doc?.getElementById("channelMessageBtn") || null; - if (!notifyBtn && !messageBtn) { + if (!messageBtn) { return; } @@ -3371,46 +3346,6 @@ function setupChannelMessageControls() { devLogger.warn("[ChannelProfile] Unable to resolve channel hex for controls."); } - if (notifyBtn) { - syncChannelNotifyButtonState(notifyBtn, channelHex); - if (notifyBtn.dataset.initialized !== "true") { - notifyBtn.addEventListener("click", async () => { - const app = getApp(); - const resolvedHex = resolveChannelHexForControls(); - if (!resolvedHex) { - app?.showError?.("Unable to resolve channel notifications."); - userLogger.warn("Channel notify clicked without a valid channel hex."); - return; - } - - if (!app?.pubkey) { - openLoginModalForChannelControls(notifyBtn); - return; - } - - try { - await subscriptions.toggleChannel(resolvedHex, app.pubkey); - } catch (error) { - userLogger.error("Failed to toggle channel notifications:", error); - const permissionErrorCodes = new Set([ - "extension-permission-denied", - "nip04-missing", - ]); - const message = permissionErrorCodes.has(error?.code) - ? "Your Nostr extension must support NIP-04 to manage private lists." - : "Failed to update channel notifications. Please try again."; - app?.showError?.(message); - } finally { - syncChannelNotifyButtonState( - notifyBtn, - resolveChannelHexForControls() - ); - } - }); - notifyBtn.dataset.initialized = "true"; - } - } - if (messageBtn) { if (messageBtn.dataset.initialized !== "true") { messageBtn.addEventListener("click", () => {