Include path in web push payload for backwards compatibility

Old service workers cached in browsers still read `data.path` from the
push notification payload. Include it alongside `data.url` so notification
clicks keep working until those service workers update.

Currently we only register the service worker in the notification
settings screen, so this won't happen very often. Once we introduce
offline mode, we'll register the service worker in more places, so we
should be able to remove this.
This commit is contained in:
Rosa Gutierrez
2026-02-25 20:09:57 +01:00
committed by Rosa Gutierrez
parent 5b689dfac7
commit fc0e477141
+1 -1
View File
@@ -20,7 +20,7 @@ class WebPush::Notification
end end
def encoded_message def encoded_message
JSON.generate title: @title, options: { body: @body, icon: icon_path, data: { url: @url, badge: @badge } } JSON.generate title: @title, options: { body: @body, icon: icon_path, data: { url: @url, path: @url, badge: @badge } }
end end
def icon_path def icon_path