Ensure deletes are handled after everything else

This commit is contained in:
FloatingGhost 2022-10-11 14:30:08 +01:00
parent cb9b0d3720
commit 856c57208b
6 changed files with 27 additions and 17 deletions

View file

@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Changes
- Follows no longer override domain blocks, a domain block is final
- Deletes are now the lowest priority to publish and will be handled after creates
## 2022.10

View file

@ -569,7 +569,10 @@ config :pleroma, Oban,
mute_expire: 5,
search_indexing: 10
],
plugins: [Oban.Plugins.Pruner],
plugins: [
Oban.Plugins.Pruner,
{Oban.Plugins.Reindexer, schedule: "@weekly"}
],
crontab: [
{"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker},
{"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker}

View file

@ -538,6 +538,12 @@ defmodule Mix.Tasks.Pleroma.User do
end
end
def run(["convert_id", id]) do
{:ok, uuid} = FlakeId.Ecto.Type.dump(id)
{:ok, raw_id} = Ecto.UUID.load(uuid)
shell_info(raw_id)
end
defp refetch_public_keys(query) do
query
|> Pleroma.Repo.chunk_stream(50, :batches)

View file

@ -323,8 +323,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
end
if result == :ok do
Notification.create_notifications(object)
# Only remove from index when deleting actual objects, not users or anything else
with %Pleroma.Object{} <- deleted_object do
Pleroma.Search.remove_from_index(deleted_object)

View file

@ -53,12 +53,19 @@ defmodule Pleroma.Web.Federator do
@impl true
def publish(%{data: %{"object" => object}} = activity) when is_map(object) or is_list(object) do
PublisherWorker.enqueue("publish", %{
"activity_id" => activity.id,
"object_data" => Jason.encode!(object)
})
PublisherWorker.enqueue(
"publish",
%{
"activity_id" => activity.id,
"object_data" => Jason.encode!(object)
},
priority: publish_priority(activity)
)
end
defp publish_priority(%{type: "Delete"}), do: 3
defp publish_priority(_), do: 0
# Job Worker Callbacks
@spec perform(atom(), module(), any()) :: {:ok, any()} | {:error, any()}

View file

@ -63,16 +63,11 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPI do
def get_notifications(user, params \\ %{}) do
options = cast_params(params)
query =
user
|> Notification.for_user_query(options)
|> restrict(:include_types, options)
|> restrict(:exclude_types, options)
|> restrict(:account_ap_id, options)
IO.inspect(Pleroma.Repo.to_sql(:all, query))
query
user
|> Notification.for_user_query(options)
|> restrict(:include_types, options)
|> restrict(:exclude_types, options)
|> restrict(:account_ap_id, options)
|> Pagination.fetch_paginated(params)
end