fix: ensure that from is properly set on all notifications

fix: typo in bulk destroy not clearing ash_started_transaction state
This commit is contained in:
Zach Daniel 2024-08-30 11:45:55 -04:00
parent 7702cdc2f6
commit c7b861c511
3 changed files with 3 additions and 4 deletions

View file

@ -344,7 +344,7 @@ defmodule Ash.Actions.Destroy.Bulk do
end
after
if notify? do
Process.delete(:ash_started_transaction)
Process.delete(:ash_started_transaction?)
end
end
end

View file

@ -313,7 +313,6 @@ defmodule Ash.Actions.Helpers do
for: Ash.Resource.Info.notifiers(changeset.resource) ++ changeset.action.notifiers,
data: result,
changeset: changeset,
from: self(),
metadata: opts[:notification_metadata] || %{}
}
end

View file

@ -39,12 +39,12 @@ defmodule Ash.Notifier do
case notification.for do
nil ->
for notifier <- Ash.Resource.Info.notifiers(resource) do
notifier.notify(notification)
notifier.notify(%{notification | from: self()})
end
allowed_notifiers ->
for notifier <- Enum.uniq(List.wrap(allowed_notifiers)) do
notifier.notify(notification)
notifier.notify(%{notification | from: self()})
end
end
end