Notifications don't send for bulk actions by default

When you do a single record action, notifications are published by default. However, when you do bulk actions, notifications are not published by default. If you want notifications published for bulk actions, you have to add bulk_options: [notify?: true] To avoid putting it on all call sites, you can set this as a default option on your Domain's code interface function opts.
define :create_foo do
action :create
default_options bulk_options: [notify?: true]
end
define :create_foo do
action :create
default_options bulk_options: [notify?: true]
end
3 Replies
ZachDaniel
ZachDaniel•4mo ago
hmmm....for code interfaces it's supposed to notify bulk actions by default is it not? if so the. TYL about a bug 😂
Chaz Watkins
Chaz WatkinsOP•4mo ago
It wasn’t for me. It would only send when doing single record actions until I added notify?: true. I’ll create an issue and provide reproduction steps I’ll probably skip the issue and look into submitting a PR. If it is a bug, it’ll likely be trivial to fix
Chaz Watkins
Chaz WatkinsOP•4mo ago
You were right, bulk_create in the code_interface wasn't adding notify?: true by default like :update and :destroy. PR Submitted - https://github.com/ash-project/ash/pull/2130
GitHub
fix(code_interface): add notify?: true for bulk creates by chazwatk...
Changes Code Interface: Add Keyword.put(:notify?, true) to bulk_options for bulk creates so notifications are sent by default like :update and :destroy actions Contributor checklist Leave anythin...

Did you find this page helpful?