From 291f4e2d14c57297f89c9ab8f7d458cd6a18a5c4 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Tue, 15 Jul 2025 18:09:30 -0500 Subject: [PATCH] Now that the basics are working, update debug to catch real issues - I'll use these to update the UI later --- app/javascript/controllers/notifications_controller.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/javascript/controllers/notifications_controller.js b/app/javascript/controllers/notifications_controller.js index 223d7cff0..74ede838e 100644 --- a/app/javascript/controllers/notifications_controller.js +++ b/app/javascript/controllers/notifications_controller.js @@ -2,14 +2,10 @@ import { Controller } from "@hotwired/stimulus" import { post } from "@rails/request.js" import { pageIsTurboPreview } from "helpers/turbo_helpers" import { onNextEventLoopTick } from "helpers/timing_helpers" - -console.log("Notifications controller module loaded") - export default class extends Controller { static values = { subscriptionsUrl: String } async connect() { - console.log("connected") if (!pageIsTurboPreview()) { if (window.notificationsPreviouslyReady) { onNextEventLoopTick(() => this.dispatch("ready")) @@ -25,15 +21,16 @@ export default class extends Controller { } async attemptToSubscribe() { - console.log("attemptToSubscribe") if (this.#allowed) { const registration = await this.#serviceWorkerRegistration || await this.#registerServiceWorker() switch(Notification.permission) { - case "denied": { break } + case "denied": { console.log("Notification.permission: denied"); break } case "granted": { this.#subscribe(registration); break } case "default": { this.#requestPermissionAndSubscribe(registration) } } + } else { + console.log("Should display not-allowed notice") } }