refactor: Replace actor option patterns with ash_actor_opts helper

- Replace if actor, do: [actor: actor], else: [] with Mv.Helpers.ash_actor_opts/1
- Update email_sync/loader.ex, member validations, member.ex, cycle_generator.ex
- Consistent actor handling across non-LiveView modules
This commit is contained in:
Moritz 2026-01-13 14:05:41 +01:00
parent fdbe673a65
commit 7b28b03cd4
4 changed files with 27 additions and 6 deletions

View file

@ -39,6 +39,7 @@ defmodule Mv.Membership.Member do
require Ash.Query
import Ash.Expr
alias Mv.Helpers
require Logger
# Module constants
@ -1235,7 +1236,7 @@ defmodule Mv.Membership.Member do
# Extracts custom field values from existing member data (update scenario)
defp extract_existing_values(member_data, changeset) do
actor = Map.get(changeset.context, :actor)
opts = if actor, do: [actor: actor], else: []
opts = Helpers.ash_actor_opts(actor)
case Ash.load(member_data, :custom_field_values, opts) do
{:ok, %{custom_field_values: existing_values}} ->