federator: actually relay the public activities
This commit is contained in:
parent
f9b0fc4ddb
commit
1c40a631e8
|
@ -1,5 +1,5 @@
|
||||||
defmodule Pleroma.Web.ActivityPub.Relay do
|
defmodule Pleroma.Web.ActivityPub.Relay do
|
||||||
alias Pleroma.User
|
alias Pleroma.{User, Object}
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
@ -30,4 +30,13 @@ def unfollow(target_instance) do
|
||||||
|
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def publish(activity) do
|
||||||
|
with %User{} = user <- get_actor(),
|
||||||
|
%Object{} = object <- Object.normalize(activity.data["object"]["id"]) do
|
||||||
|
ActivityPub.announce(user, object)
|
||||||
|
else
|
||||||
|
e -> Logger.error("error: #{inspect(e)}")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,7 @@ defmodule Pleroma.Web.Federator do
|
||||||
alias Pleroma.Activity
|
alias Pleroma.Activity
|
||||||
alias Pleroma.Web.{WebFinger, Websub}
|
alias Pleroma.Web.{WebFinger, Websub}
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
|
alias Pleroma.Web.ActivityPub.Relay
|
||||||
alias Pleroma.Web.ActivityPub.Transmogrifier
|
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||||
alias Pleroma.Web.ActivityPub.Utils
|
alias Pleroma.Web.ActivityPub.Utils
|
||||||
require Logger
|
require Logger
|
||||||
|
@ -69,6 +70,9 @@ def handle(:publish, activity) do
|
||||||
|
|
||||||
Logger.info(fn -> "Sending #{activity.data["id"]} out via Salmon" end)
|
Logger.info(fn -> "Sending #{activity.data["id"]} out via Salmon" end)
|
||||||
Pleroma.Web.Salmon.publish(actor, activity)
|
Pleroma.Web.Salmon.publish(actor, activity)
|
||||||
|
|
||||||
|
Logger.info(fn -> "Relaying #{activity.data["id"]} out" end)
|
||||||
|
Pleroma.Web.ActivityPub.Relay.publish(activity)
|
||||||
end
|
end
|
||||||
|
|
||||||
Logger.info(fn -> "Sending #{activity.data["id"]} out via AP" end)
|
Logger.info(fn -> "Sending #{activity.data["id"]} out via AP" end)
|
||||||
|
|
Loading…
Reference in a new issue