Add an error log when we try to update the relay actor

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-10-31 11:41:36 +01:00
parent 1df02512af
commit 9ce618a267
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
1 changed files with 8 additions and 1 deletions

View File

@ -246,7 +246,14 @@ defmodule Mobilizon.Actors do
Updates an actor.
"""
@spec update_actor(Actor.t(), map) :: {:ok, Actor.t()} | {:error, Ecto.Changeset.t()}
def update_actor(%Actor{} = actor, attrs) do
def update_actor(%Actor{preferred_username: preferred_username, domain: domain} = actor, attrs) do
if is_nil(domain) and preferred_username == "relay" do
Logger.error("Trying to update local relay actor",
attrs: attrs,
trace: Process.info(self(), :current_stacktrace)
)
end
actor
|> Repo.preload(@associations_to_preload)
|> Actor.update_changeset(attrs)