mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: handle small logic error in notification sending for bulk actions
This commit is contained in:
parent
26871fa552
commit
93ae8f17a5
2 changed files with 18 additions and 10 deletions
|
@ -427,14 +427,18 @@ defmodule Ash.Actions.Destroy.Bulk do
|
||||||
{Enum.reverse(errors), Enum.reverse(successes), notifications, error_count}
|
{Enum.reverse(errors), Enum.reverse(successes), notifications, error_count}
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
{[], results, [], 0}
|
{[], results || [], [], 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
notifications =
|
notifications =
|
||||||
|
if opts[:notify?] do
|
||||||
notifications ++
|
notifications ++
|
||||||
Enum.map(results, fn result ->
|
Enum.map(results, fn result ->
|
||||||
notification(atomic_changeset, result, opts)
|
notification(atomic_changeset, result, opts)
|
||||||
end)
|
end)
|
||||||
|
else
|
||||||
|
notifications
|
||||||
|
end
|
||||||
|
|
||||||
status =
|
status =
|
||||||
case {error_count, results} do
|
case {error_count, results} do
|
||||||
|
|
|
@ -384,7 +384,7 @@ defmodule Ash.Actions.Update.Bulk do
|
||||||
{Enum.reverse(errors), Enum.reverse(successes), notifications, error_count}
|
{Enum.reverse(errors), Enum.reverse(successes), notifications, error_count}
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
{[], results, [], 0}
|
{[], results || [], [], 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
{results, errors, error_count} =
|
{results, errors, error_count} =
|
||||||
|
@ -403,10 +403,14 @@ defmodule Ash.Actions.Update.Bulk do
|
||||||
end
|
end
|
||||||
|
|
||||||
notifications =
|
notifications =
|
||||||
|
if opts[:notify?] do
|
||||||
notifications ++
|
notifications ++
|
||||||
Enum.map(results, fn result ->
|
Enum.map(results, fn result ->
|
||||||
notification(atomic_changeset, result, opts)
|
notification(atomic_changeset, result, opts)
|
||||||
end)
|
end)
|
||||||
|
else
|
||||||
|
notifications
|
||||||
|
end
|
||||||
|
|
||||||
status =
|
status =
|
||||||
case {error_count, results} do
|
case {error_count, results} do
|
||||||
|
|
Loading…
Reference in a new issue