mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
chore: better notification handling
This commit is contained in:
parent
dcd8f305b6
commit
911acdef5b
1 changed files with 14 additions and 8 deletions
|
@ -124,15 +124,21 @@ defmodule Ash.Engine do
|
||||||
)
|
)
|
||||||
|> case do
|
|> case do
|
||||||
{:ok, result} ->
|
{:ok, result} ->
|
||||||
saved_notifications = Process.delete(:ash_engine_notifications)
|
saved_notifications = Process.delete(:ash_engine_notifications) || []
|
||||||
remaining_notifications = Ash.Notifier.notify(saved_notifications)
|
|
||||||
|
|
||||||
{:ok,
|
if opts[:return_notifications?] do
|
||||||
%{
|
{:ok,
|
||||||
result
|
%{
|
||||||
| resource_notifications:
|
result
|
||||||
result.resource_notifications ++ remaining_notifications
|
| resource_notifications:
|
||||||
}}
|
result.resource_notifications ++ saved_notifications
|
||||||
|
}}
|
||||||
|
else
|
||||||
|
remaining_notifications =
|
||||||
|
Ash.Notifier.notify(result.resource_notifications ++ saved_notifications)
|
||||||
|
|
||||||
|
{:ok, %{result | resource_notifications: remaining_notifications}}
|
||||||
|
end
|
||||||
|
|
||||||
{:error, error} ->
|
{:error, error} ->
|
||||||
{:error, error}
|
{:error, error}
|
||||||
|
|
Loading…
Reference in a new issue