From 6a452cfd2371d50d611e73655bb118d2145f7133 Mon Sep 17 00:00:00 2001 From: dadachi Date: Fri, 30 Oct 2026 20:23:12 +0900 Subject: [PATCH] Play the default sound with the item tag push Without aps.sound in the payload iOS showed the notification silently, though the apps ask for the .sound authorization. Found on an iPhone against the local development server (release checklist, record 21). Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + app/notifiers/item_tag_notifier.rb | 4 +++- test/notifiers/item_tag_notifier_test.rb | 12 ++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a53f265..08dab7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## [Unreleased] +- The item tag push plays the default sound (`sound: "default"` in `ItemTagNotifier`): without `aps.sound` iOS showed it silently. FCM gets the same `sound`; Android 8+ still follows the `item_tag_completed` channel - Security: `PUT`/`PATCH /shopkeeper_auth/password` needs the reset link's `reset_password_token`. With `require_client_password_reset_token`, devise_token_auth's update never checks the current password, so a request signed in with just the access token changed the password without the old one; sent with a `current_password`, it failed with a 500. Without the token the request now gets 401; only the reset page's form posts here, and the apps change the password with `PATCH /api/v1/shopkeeper/account/password`, which asks for the current one. The check reads the value the gem reads, so a token sent as an array or a hash cannot slip past it. Ported from myturntagapi #231, where it was found ## 2026-10-29 diff --git a/app/notifiers/item_tag_notifier.rb b/app/notifiers/item_tag_notifier.rb index 2bcbd32..0a914a4 100644 --- a/app/notifiers/item_tag_notifier.rb +++ b/app/notifiers/item_tag_notifier.rb @@ -4,7 +4,9 @@ class ItemTagNotifier < ApplicationNotifier config.format = -> { { title: title, - body: body + body: body, + # iOS plays no sound without aps.sound in the payload + sound: "default" } } # No url: the apps open no screen for an item tag diff --git a/test/notifiers/item_tag_notifier_test.rb b/test/notifiers/item_tag_notifier_test.rb index 2483e01..5691681 100644 --- a/test/notifiers/item_tag_notifier_test.rb +++ b/test/notifiers/item_tag_notifier_test.rb @@ -43,6 +43,18 @@ class ItemTagNotifierTest < ActiveSupport::TestCase assert_equal({}, notification.instance_exec(&ItemTagNotifier.delivery_methods[:action_push_native].config[:with_data])) end + # Without a sound APNs shows the alert silently: iOS plays no sound when the + # payload has no aps.sound, even with the .sound authorization. Found on an + # iPhone against the local development server (release checklist, record 21) + test "the push plays the default sound" do + ItemTagNotifier.with(record: @item_tag).deliver(@shopkeeper) + notification = @shopkeeper.notifications.last + format = notification.instance_exec(&ItemTagNotifier.delivery_methods[:action_push_native].config[:format]) + + assert_equal "default", format[:sound] + assert_equal "default", ApplicationPushNotification.new(**format).sound + end + test "action_push_native delivery performs without raising" do ApplicationPushDevice.create!(owner: @shopkeeper, platform: "apple", token: "test-token")