Skip to content

Commit

Permalink
fix: honor return_destroyed? in soft destroy actions
Browse files Browse the repository at this point in the history
fixes #1433
  • Loading branch information
zachdaniel committed Sep 2, 2024
1 parent 1002d81 commit abef091
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/ash/actions/update/update.ex
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ defmodule Ash.Actions.Update do
changeset.action,
changeset,
instructions,
opts[:return_notifications?]
opts[:return_notifications?],
opts[:return_destroyed?]
)
end
|> case do
Expand Down Expand Up @@ -351,18 +352,19 @@ defmodule Ash.Actions.Update do
action,
changeset,
instructions,
return_notifications?
return_notifications?,
return_destroyed?
) do
if return_notifications? do
if changeset.action_type == :destroy do
if changeset.action_type == :destroy && !return_destroyed? do
{:ok, Map.get(instructions, :notifications, [])}
else
{:ok, result, Map.get(instructions, :notifications, [])}
end
else
Helpers.warn_missed!(resource, action, instructions)

if changeset.action_type == :destroy do
if changeset.action_type == :destroy && !return_destroyed? do
:ok
else
{:ok, result}
Expand Down

0 comments on commit abef091

Please sign in to comment.