mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: don't notify unless notify?: true
in bulk creates
This commit is contained in:
parent
d56937aeb6
commit
35b1278830
1 changed files with 14 additions and 1 deletions
|
@ -657,6 +657,13 @@ defmodule Ash.Actions.Create.Bulk do
|
|||
{changeset, %{notifications: new_notifications}} =
|
||||
Ash.Changeset.run_before_actions(changeset)
|
||||
|
||||
new_notifications =
|
||||
if opts[:notify?] do
|
||||
new_notifications
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
if changeset.valid? do
|
||||
{[changeset | changesets], invalid, notifications ++ new_notifications}
|
||||
else
|
||||
|
@ -840,7 +847,13 @@ defmodule Ash.Actions.Create.Bulk do
|
|||
{[], notifications, changesets_by_index, []},
|
||||
fn result, {results, notifications, changesets_by_index, errors} ->
|
||||
changeset = changesets_by_index[result.__metadata__.bulk_create_index]
|
||||
notifications = notifications ++ [notification(changeset, result, opts)]
|
||||
|
||||
notifications =
|
||||
if opts[:notify?] do
|
||||
[notification(changeset, result, opts) | notifications]
|
||||
else
|
||||
notifications
|
||||
end
|
||||
|
||||
try do
|
||||
case Ash.Changeset.run_after_transactions({:ok, result}, changeset) do
|
||||
|
|
Loading…
Reference in a new issue