projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'add-admin-and-moderator-fields' into 'develop'
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
activity_pub.ex
diff --git
a/lib/pleroma/web/activity_pub/activity_pub.ex
b/lib/pleroma/web/activity_pub/activity_pub.ex
index 22c7824fa23c3e8862b5cf23b2e6a7ee62650f90..b33912721782fb05cfbf3f32ee0fed3b7f2412b8 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub.ex
@@
-88,6
+88,10
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
recipients: recipients
})
recipients: recipients
})
+ Task.start(fn ->
+ Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity)
+ end)
+
Notification.create_notifications(activity)
stream_out(activity)
{:ok, activity}
Notification.create_notifications(activity)
stream_out(activity)
{:ok, activity}
@@
-517,7
+521,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
defp restrict_actor(query, _), do: query
defp restrict_type(query, %{"type" => type}) when is_binary(type) do
defp restrict_actor(query, _), do: query
defp restrict_type(query, %{"type" => type}) when is_binary(type) do
-
restrict_type(query, %{"type" => [type]}
)
+
from(activity in query, where: fragment("?->>'type' = ?", activity.data, ^type)
)
end
defp restrict_type(query, %{"type" => type}) do
end
defp restrict_type(query, %{"type" => type}) do
@@
-740,7
+744,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
public = is_public?(activity)
public = is_public?(activity)
- re
mote_inboxes
=
+ re
achable_inboxes_metadata
=
(Pleroma.Web.Salmon.remote_users(activity) ++ remote_followers)
|> Enum.filter(fn user -> User.ap_enabled?(user) end)
|> Enum.map(fn %{info: %{source_data: data}} ->
(Pleroma.Web.Salmon.remote_users(activity) ++ remote_followers)
|> Enum.filter(fn user -> User.ap_enabled?(user) end)
|> Enum.map(fn %{info: %{source_data: data}} ->
@@
-753,17
+757,18
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
json = Jason.encode!(data)
{:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
json = Jason.encode!(data)
- Enum.each(re
mote_inboxes, fn inbox
->
+ Enum.each(re
achable_inboxes_metadata, fn {inbox, unreachable_since}
->
Federator.enqueue(:publish_single_ap, %{
inbox: inbox,
json: json,
actor: actor,
Federator.enqueue(:publish_single_ap, %{
inbox: inbox,
json: json,
actor: actor,
- id: activity.data["id"]
+ id: activity.data["id"],
+ unreachable_since: unreachable_since
})
end)
end
})
end)
end
- def publish_one(%{inbox: inbox, json: json, actor: actor, id: id}) do
+ def publish_one(%{inbox: inbox, json: json, actor: actor, id: id}
= params
) do
Logger.info("Federating #{id} to #{inbox}")
host = URI.parse(inbox).host
Logger.info("Federating #{id} to #{inbox}")
host = URI.parse(inbox).host
@@
-784,15
+789,16
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
[
{"Content-Type", "application/activity+json"},
{"signature", signature},
[
{"Content-Type", "application/activity+json"},
{"signature", signature},
- {"digest", digest},
- {"referer", Pleroma.Web.Endpoint.url()}
+ {"digest", digest}
]
) do
]
) do
- Instances.set_reachable(inbox)
+ if !Map.has_key?(params, :unreachable_since) || params[:unreachable_since],
+ do: Instances.set_reachable(inbox)
+
result
else
{_post_result, response} ->
result
else
{_post_result, response} ->
- Instances.set_unreachable(inbox)
+
unless params[:unreachable_since], do:
Instances.set_unreachable(inbox)
{:error, response}
end
end
{:error, response}
end
end