delete activities

This commit is contained in:
FloatingGhost 2021-12-30 17:47:41 +00:00
parent 12a171844b
commit 4e8ee48cff
2 changed files with 10 additions and 0 deletions

View file

@ -14,6 +14,12 @@ defmodule Pleroma.Elasticsearch do
Config.get([:search, :provider]) == Pleroma.Search.Elasticsearch Config.get([:search, :provider]) == Pleroma.Search.Elasticsearch
end end
def delete_by_id(:activity, id) do
if enabled?() do
Elastix.Document.delete(url(), "activities", "activity", id)
end
end
def put_by_id(:activity, id) do def put_by_id(:activity, id) do
id id
|> Activity.get_by_id_with_object() |> Activity.get_by_id_with_object()

View file

@ -542,6 +542,10 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
Pleroma.Elasticsearch.put_by_id(:activity, activity.id) Pleroma.Elasticsearch.put_by_id(:activity, activity.id)
end end
def handle_after_transaction(%Pleroma.Activity{data: %{"type" => "Delete", "deleted_activity_id" => id}}) do
Pleroma.Elasticsearch.delete_by_id(:activity, id)
end
def handle_after_transaction(%Pleroma.Activity{}) do def handle_after_transaction(%Pleroma.Activity{}) do
:ok :ok
end end