Skip to content

Commit caf5c16

Browse files
refactor: update notifier callback return type and simplify notify implementation
1 parent e9ae04b commit caf5c16

4 files changed

Lines changed: 9 additions & 14 deletions

File tree

.github/workflows/test-subprojects.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
test-subprojects:
1515
runs-on: ubuntu-latest
1616
name: Subproject ${{matrix.project.org}}/${{matrix.project.name}} - OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
17+
if: ${{ github.repository == 'ash-project/ash' || matrix.project.name != 'ash_oban' }}
1718
strategy:
1819
fail-fast: false
1920
matrix:

lib/ash/behaviour_helpers.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ defmodule Ash.BehaviourHelpers do
99
## Behaviour invocation pattern
1010
1111
Implementation modules (e.g. a module that `@behaviour Ash.Resource.Change`) should be invoked
12-
**only through the behaviours public wrapper functions** (e.g. `Ash.Resource.Change.change/4`,
13-
`Ash.Resource.Change.atomic/4`). Call sites must call `SomeBehaviour.callback(implementation_module, ...)`
14-
rather than `implementation_module.callback(...)`.
12+
**only through the behaviour module's public wrapper callbacks**. Call sites must call
13+
`SomeBehaviour.callback(implementation_module, ...)` rather than
14+
`implementation_module.callback(...)`.
1515
1616
Those wrappers:
1717

lib/ash/changeset/changeset.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,8 @@ defmodule Ash.Changeset do
12331233
{:atomic, condition} <-
12341234
atomic_condition(where, changeset, context),
12351235
{{:atomic, modified_changeset?, new_changeset, atomic_changes, validations,
1236-
create_atomics}, condition} <-
1236+
create_atomics},
1237+
condition} <-
12371238
{atomic_with_changeset(
12381239
Ash.Resource.Change.atomic(
12391240
module,

lib/ash/notifier/notifier.ex

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Ash.Notifier do
66
@moduledoc """
77
A notifier is an extension that receives various events
88
"""
9-
@callback notify(Ash.Notifier.Notification.t()) :: :ok
9+
@callback notify(Ash.Notifier.Notification.t()) :: any()
1010
@callback requires_original_data?(Ash.Resource.t(), Ash.Resource.Actions.action()) :: boolean
1111

1212
@doc """
@@ -29,16 +29,9 @@ defmodule Ash.Notifier do
2929
require Logger
3030

3131
@doc false
32-
@spec notify(module(), Ash.Notifier.Notification.t()) :: :ok
32+
@spec notify(module(), Ash.Notifier.Notification.t()) :: any()
3333
def notify(notifier_module, notification) do
34-
Ash.BehaviourHelpers.call_and_validate_return(
35-
notifier_module,
36-
:notify,
37-
[notification],
38-
[:ok],
39-
behaviour: __MODULE__,
40-
callback_name: "notify/1"
41-
)
34+
apply(notifier_module, :notify, [notification])
4235
end
4336

4437
@doc false

0 commit comments

Comments
 (0)