fix: handle small logic error in notification sending for bulk actions

This commit is contained in:
Zach Daniel 2024-02-25 16:13:41 -05:00
parent 26871fa552
commit 93ae8f17a5
2 changed files with 18 additions and 10 deletions

View file

@ -427,14 +427,18 @@ defmodule Ash.Actions.Destroy.Bulk do
{Enum.reverse(errors), Enum.reverse(successes), notifications, error_count}
end)
else
{[], results, [], 0}
{[], results || [], [], 0}
end
notifications =
if opts[:notify?] do
notifications ++
Enum.map(results, fn result ->
notification(atomic_changeset, result, opts)
end)
else
notifications
end
status =
case {error_count, results} do

View file

@ -384,7 +384,7 @@ defmodule Ash.Actions.Update.Bulk do
{Enum.reverse(errors), Enum.reverse(successes), notifications, error_count}
end)
else
{[], results, [], 0}
{[], results || [], [], 0}
end
{results, errors, error_count} =
@ -403,10 +403,14 @@ defmodule Ash.Actions.Update.Bulk do
end
notifications =
if opts[:notify?] do
notifications ++
Enum.map(results, fn result ->
notification(atomic_changeset, result, opts)
end)
else
notifications
end
status =
case {error_count, results} do