Files
once-campfire/app/views/rooms/involvements/_bell.html.erb
T
Jeremy Daer fadf6f1859 Post the browser's push subscription from every page, and register it once
Only room pages posted the subscription again, so a browser that
changed its password and closed the profile page went without
notifications until it next opened a room. A small controller in the
layout does it now, still once per session, and the bell is back to how
it was.

Two tabs posting at once after a password change could both miss the
row and insert two, so the endpoint is looked up again under the same
write lock as the session check.

From #371.

(cherry picked from commit 3786ee5244)
2026-10-19 13:15:14 -07:00

39 lines
2.0 KiB
ERB
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<span>
<span class="button_to_change_notifying"
data-controller="notifications" data-notifications-subscriptions-url-value="<%= user_push_subscriptions_path %>" data-notifications-attention-class="btn--pulsing">
<%= turbo_frame_tag dom_id(room, :involvement), data: {
controller: "turbo-frame", action: "notifications:ready@window->turbo-frame#load", turbo_frame_url_param: room_involvement_path(room) } do %>
<button class="btn" data-action="click->notifications#attemptToSubscribe" data-notifications-target="bell">
<%= image_tag "notification-bell-loading.svg", size: 20, aria: { hidden: "true" } %>
<%= image_tag "notification-bell-alert.svg", size: 20, aria: { hidden: "true" }, hidden: true %>
<span class="for-screen-reader">Notification settings for this <%= room.direct? ? "Ping" : "room" %></span>
</button>
<% end %>
<dialog data-notifications-target="notAllowedNotice" class="dialog pad center center-block border-radius border shadow" style="--inline-space: var(--block-space)">
<div class="flex flex-column txt-align-center">
<span class="btn btn--faux center txt-x-large">
<%= image_tag "notification-bell-alert.svg", size: 48, aria: { hidden: "true" } %>
<span class="for-screen-reader">Notifications alert</span>
</span>
<section>
<h1 class="txt-large margin-none">Notifications aren’t allowed</h1>
<div class="txt-align-start margin-block-start">
<%= render partial: "pwa/browser_settings" %>
<%= render partial: "pwa/system_settings" %>
<%= render partial: "pwa/install_instructions" %>
</div>
</section>
<form method="dialog" class="flex align-center gap center">
<button class="btn dialog__close" autofocus="true">
<span class="for-screen-reader">Close</span>
<%= image_tag "remove.svg", size: 20, aria: { hidden: "true" } %>
</button>
</form>
</div>
</dialog>
</span>
</span>