Merge branch 'akkoma/delete-improvements' into 'develop'

Alter priority of Delete activities to be lowest

See merge request pleroma/pleroma!3782
This commit is contained in:
lain 2022-11-14 07:24:46 +00:00
commit 0e1356ef9c
4 changed files with 49 additions and 4 deletions

View file

@ -282,7 +282,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
# Tasks this handles:
# - Delete and unpins the create activity
# - Replace object with Tombstone
# - Set up notification
# - Reduce the user note count
# - Reduce the reply count
# - Stream out the activity
@ -324,7 +323,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
end
if result == :ok do
Notification.create_notifications(object)
{:ok, object, meta}
else
{:error, result}

View file

@ -47,10 +47,15 @@ defmodule Pleroma.Web.Federator do
end
@impl true
def publish(activity) do
PublisherWorker.enqueue("publish", %{"activity_id" => activity.id})
def publish(%Pleroma.Activity{data: %{"type" => type}} = activity) do
PublisherWorker.enqueue("publish", %{"activity_id" => activity.id},
priority: publish_priority(type)
)
end
defp publish_priority("Delete"), do: 3
defp publish_priority(_), do: 0
# Job Worker Callbacks
@spec perform(atom(), module(), any()) :: {:ok, any()} | {:error, any()}