projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ActivityPub: tags -> tag.
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
utils.ex
diff --git
a/lib/pleroma/web/activity_pub/utils.ex
b/lib/pleroma/web/activity_pub/utils.ex
index 4e3a7e2bd6b0ffbadfda825aedefc1711cbfcc67..b32b7240eb201b03bc936d215fb67cc7e50ef868 100644
(file)
--- a/
lib/pleroma/web/activity_pub/utils.ex
+++ b/
lib/pleroma/web/activity_pub/utils.ex
@@
-29,7
+29,12
@@
defmodule Pleroma.Web.ActivityPub.Utils do
Enqueues an activity for federation if it's local
"""
def maybe_federate(%Activity{local: true} = activity) do
Enqueues an activity for federation if it's local
"""
def maybe_federate(%Activity{local: true} = activity) do
- Pleroma.Web.Federator.enqueue(:publish, activity)
+ priority = case activity.data["type"] do
+ "Delete" -> 10
+ "Create" -> 1
+ _ -> 5
+ end
+ Pleroma.Web.Federator.enqueue(:publish, activity, priority)
:ok
end
def maybe_federate(_), do: :ok
:ok
end
def maybe_federate(_), do: :ok
@@
-64,7
+69,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
Inserts a full object if it is contained in an activity.
"""
def insert_full_object(%{"object" => object_data}) when is_map(object_data) do
Inserts a full object if it is contained in an activity.
"""
def insert_full_object(%{"object" => object_data}) when is_map(object_data) do
- with {:ok,
object
} <- Object.create(object_data) do
+ with {:ok,
_
} <- Object.create(object_data) do
:ok
end
end
:ok
end
end
@@
-88,7
+93,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
@doc """
Returns an existing like if a user already liked an object
"""
@doc """
Returns an existing like if a user already liked an object
"""
- def get_existing_like(actor, %{data: %{"id" => id}}
= object
) do
+ def get_existing_like(actor, %{data: %{"id" => id}}) do
query = from activity in Activity,
where: fragment("(?)->>'actor' = ?", activity.data, ^actor),
# this is to use the index
query = from activity in Activity,
where: fragment("(?)->>'actor' = ?", activity.data, ^actor),
# this is to use the index
@@
-200,8
+205,7
@@
defmodule Pleroma.Web.ActivityPub.Utils do
def make_create_data(params, additional) do
published = params.published || make_date()
def make_create_data(params, additional) do
published = params.published || make_date()
-
- activity = %{
+ %{
"type" => "Create",
"to" => params.to |> Enum.uniq,
"actor" => params.actor.ap_id,
"type" => "Create",
"to" => params.to |> Enum.uniq,
"actor" => params.actor.ap_id,