Improve notifier filter handing to avoid compiler cycle

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-10-25 13:21:19 +02:00
parent bac6628aea
commit 59edfe26cc
3 changed files with 17 additions and 11 deletions

View File

@@ -72,6 +72,12 @@ defmodule Mobilizon.Users do
|> Repo.preload([:settings])
end
def get_user_with_activity_settings!(id) do
User
|> Repo.get(id)
|> Repo.preload([:settings, :activity_settings])
end
@doc """
Gets an user by its email.
"""
@@ -430,12 +436,6 @@ defmodule Mobilizon.Users do
|> Repo.all()
end
def activity_setting(%User{id: user_id}, key, method) do
ActivitySetting
|> where([a], a.user_id == ^user_id and a.key == ^key and a.method == ^method)
|> Repo.one()
end
@doc """
Creates an activity setting. Overrides existing values if present