Skip to content

A platform for community discussion. Free, open, simple.

FIX: Service worker push notifications when cache disabled (#25610)

David Taylor234795c70ec0
diff --git a/app/assets/javascripts/service-worker.js.erb b/app/assets/javascripts/service-worker.js.erb
index 9ac89b49d85..b5ee47fb887 100644
--- a/app/assets/javascripts/service-worker.js.erb
+++ b/app/assets/javascripts/service-worker.js.erb
@@ -22,8 +22,6 @@ workbox.setConfig({
});
var authUrls = ["auth", "session/sso_login", "session/sso", "srv/status"].map(path => `<%= Discourse.base_path %>/${path}`);
-var chatRegex = /\/chat\/channel\/(\d+)\//;
-var inlineReplyIcon = "<%= UrlHelper.absolute("/images/push-notifications/inline_reply.png") %>";
const oldCacheNames = [
"discourse-1", "external-1"
@@ -147,6 +145,9 @@ workbox.routing.registerRoute(
);
<% end %>
+var chatRegex = /\/chat\/channel\/(\d+)\//;
+var inlineReplyIcon = "<%= UrlHelper.absolute("/images/push-notifications/inline_reply.png") %>";
+
function showNotification(title, body, icon, badge, tag, baseUrl, url) {
var notificationOptions = {
body: body,