Send a test push notification to a specific user's registered devices to diagnose delivery issues. Results show the raw FCM / Web Push / relay response so you can see exactly what failed.
1. Look up user
<%= form_with url: super_admin_push_diagnostics_path, method: :get, local: true, class: 'flex gap-2 items-center' do |f| %> <%= f.text_field :user_query, value: @query, placeholder: 'user@example.com or numeric user ID', class: 'border border-slate-100 p-1.5 rounded-md w-80' %> <%= f.submit 'Look up', class: 'border border-slate-200 bg-slate-50 px-3 py-1.5 rounded-md cursor-pointer' %> <% end %> <% if @query.present? && @user.nil? %>No user found for "<%= @query %>".
<% end %><%= @user.name %> · <%= @user.email %> · ID <%= @user.id %>
<% if @user.accounts.any? %>Accounts: <% @user.accounts.each_with_index do |account, index| %> <%= ', ' if index.positive? %> <%= account.name %> (ID <%= account.id %>) <% end %>
<% end %>2. Select subscriptions (<%= @subscriptions.count %>)
⚠️ This sends a real push to every selected device. Use only when diagnosing a reported issue.
<% if @subscriptions.empty? %>This user has no push subscriptions registered.
<% else %> <%= form_with url: super_admin_push_diagnostics_path, method: :post, local: true do |f| %> <%= f.hidden_field :user_id, value: @user.id %>Customers will see this text as a real push notification on their device.
| ID | Type | Device / endpoint | Push token | Device details | Created | Last updated | |
|---|---|---|---|---|---|---|---|
| <%= check_box_tag 'subscription_ids[]', sub.id, false, class: 'subscription-checkbox' %> | <%= sub.id %> | <%= sub.subscription_type %> | <%= device_display %> | <%= token_display %> |
<% if extra_attrs.present? %>
<% extra_attrs.each do |k, v| %>
<%= k %>: <%= v.to_s.truncate(40) %>
<% end %>
<% else %>
—
<% end %>
|
<%= sub.created_at.strftime('%Y-%m-%d %H:%M') %> | <%= sub.updated_at.strftime('%Y-%m-%d %H:%M') %> (<%= time_ago_in_words(sub.updated_at) %> ago) |
3. Results
| Sub ID | Type | Device | Push token | Status | Details |
|---|---|---|---|---|---|
| <%= r[:id] %> | <%= r[:type] %> | <%= r[:device] %> | <%= r[:token_tail] %> | <% color = { success: 'bg-green-100 text-green-800', failure: 'bg-red-100 text-red-800', skipped: 'bg-slate-100 text-slate-600' }[r[:status]] %> <%= r[:status] %> | <%= r[:message] %> |