Skip to content

feat: add "Mark as read" and "View notifications" action buttons to push notifications#75

Open
ClickAndGoScript wants to merge 3 commits into
NodeBB:mainfrom
ClickAndGoScript:pr/2-action-buttons
Open

feat: add "Mark as read" and "View notifications" action buttons to push notifications#75
ClickAndGoScript wants to merge 3 commits into
NodeBB:mainfrom
ClickAndGoScript:pr/2-action-buttons

Conversation

@ClickAndGoScript

Copy link
Copy Markdown

Adds two action buttons to push notifications: "Mark as read" and "View
notifications". The buttons are translated server-side per the user's language
(en-GB, he, zh-CN), so they arrive already localised.

"Mark as read" calls the write API directly from the service worker — no open
forum tab needed. "View notifications" focuses an existing window or opens a
new one.

Also hardens the settings page: adds browser support detection, races
serviceWorker.ready against a 5-second timeout so the page doesn't hang
silently when no SW is registered, handles the case where notification
permission is denied before or after requestPermission(), and rolls back any
browser-level subscription if the API call fails.

Part of #64.

- Add he (Hebrew) translation for all existing strings
- Complete zh-CN translation (missing strings added)
- Move hardcoded test notification text in library.js to [[web-push:test.*]]
- Move hardcoded admin nav label in library.js to [[web-push:admin.menu-label]]
- Replace hardcoded strings in ACP template with [[web-push:admin.*]] keys
…tness

- Add "Mark as read" and "View notifications" action buttons to push notifications,
  translated server-side per user language (en-GB, he, zh-CN)
- Service worker handles button clicks: mark-read calls the write API directly
  without needing an open window; view-notifications focuses/opens the notifications page
- Pass nid in notification data payload so mark-read can identify the notification
- settings.js: add browser support detection (serviceWorker + PushManager)
- settings.js: race serviceWorker.ready against a 5s timeout to avoid infinite
  hang when no SW is registered (common on iOS before PWA install)
- settings.js: handle permission denied before and after requestPermission()
- settings.js: roll back browser-level subscription on API failure
- settings.js: show success toast on subscribe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant