projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'outbox_pagination' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
relay.ex
diff --git
a/lib/pleroma/web/activity_pub/relay.ex
b/lib/pleroma/web/activity_pub/relay.ex
index 905e85cc6207e21d4a693b9c1243b7916d494817..c2ac38907dd8cd796878363248adbae74f6b7ac9 100644
(file)
--- a/
lib/pleroma/web/activity_pub/relay.ex
+++ b/
lib/pleroma/web/activity_pub/relay.ex
@@
-22,13
+22,7
@@
defmodule Pleroma.Web.ActivityPub.Relay do
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
{:ok, activity}
else
Logger.info("relay: followed instance: #{target_instance}; id=#{activity.data["id"]}")
{:ok, activity}
else
- {:error, _} = error ->
- Logger.error("error: #{inspect(error)}")
- error
-
- e ->
- Logger.error("error: #{inspect(e)}")
- {:error, e}
+ error -> format_error(error)
end
end
end
end
@@
-36,18
+30,12
@@
defmodule Pleroma.Web.ActivityPub.Relay do
def unfollow(target_instance) do
with %User{} = local_user <- get_actor(),
{:ok, %User{} = target_user} <- User.get_or_fetch_by_ap_id(target_instance),
def unfollow(target_instance) do
with %User{} = local_user <- get_actor(),
{:ok, %User{} = target_user} <- User.get_or_fetch_by_ap_id(target_instance),
- {:ok, activity} <- ActivityPub.unfollow(local_user, target_user)
,
- {:ok, _, _} <- User.unfollow(local_user, target_user) do
+ {:ok, activity} <- ActivityPub.unfollow(local_user, target_user)
do
+ User.unfollow(local_user, target_user)
Logger.info("relay: unfollowed instance: #{target_instance}: id=#{activity.data["id"]}")
{:ok, activity}
else
Logger.info("relay: unfollowed instance: #{target_instance}: id=#{activity.data["id"]}")
{:ok, activity}
else
- {:error, _} = error ->
- Logger.error("error: #{inspect(error)}")
- error
-
- e ->
- Logger.error("error: #{inspect(e)}")
- {:error, e}
+ error -> format_error(error)
end
end
end
end
@@
-57,11
+45,16
@@
defmodule Pleroma.Web.ActivityPub.Relay do
%Object{} = object <- Object.normalize(activity) do
ActivityPub.announce(user, object, nil, true, false)
else
%Object{} = object <- Object.normalize(activity) do
ActivityPub.announce(user, object, nil, true, false)
else
- e ->
- Logger.error("error: #{inspect(e)}")
- {:error, inspect(e)}
+ error -> format_error(error)
end
end
def publish(_), do: {:error, "Not implemented"}
end
end
def publish(_), do: {:error, "Not implemented"}
+
+ defp format_error({:error, error}), do: format_error(error)
+
+ defp format_error(error) do
+ Logger.error("error: #{inspect(error)}")
+ {:error, error}
+ end
end
end