mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 19:38:04 +08:00
Currently chat notification sounds can fail to play when every Discourse tab was hidden, replayed for the same message when switching to another tab of the same site (each tab decided independently when the backlog reached it), and piled up in never-interacted tabs and played on the first click. This change answers the requesting tab as primary when no tab is focused or visible, dedupes alerts across tabs with a short-lived localStorage containing `chat_message_id`, and drops a sound instead of queuing it when the audio context is suspended. It also allows `isPrimaryTab()` to ignore unrelated service worker messages and fails open after 1s instead of hanging forever. New tests are included to avoid regressions. |
||
|---|---|---|
| .. | ||
| login.html.erb | ||
| service-worker.js.erb | ||
| show.html.erb | ||