mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-25 04:53:06 +00:00
Don't try removing deleted users and such from index as posts
This commit is contained in:
parent
7aebff799b
commit
7f53aa400b
|
@ -1,12 +1,12 @@
|
||||||
defmodule Pleroma.Search do
|
defmodule Pleroma.Search do
|
||||||
alias Pleroma.Workers.SearchIndexingWorker
|
alias Pleroma.Workers.SearchIndexingWorker
|
||||||
|
|
||||||
def add_to_index(activity) do
|
def add_to_index(%Pleroma.Activity{id: activity_id}) do
|
||||||
SearchIndexingWorker.enqueue("add_to_index", %{"activity" => activity.id})
|
SearchIndexingWorker.enqueue("add_to_index", %{"activity" => activity_id})
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_from_index(object) do
|
def remove_from_index(%Pleroma.Object{id: object_id}) do
|
||||||
SearchIndexingWorker.enqueue("remove_from_index", %{"object" => object.id})
|
SearchIndexingWorker.enqueue("remove_from_index", %{"object" => object_id})
|
||||||
end
|
end
|
||||||
|
|
||||||
def search(query, options) do
|
def search(query, options) do
|
||||||
|
|
|
@ -325,7 +325,10 @@ def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object,
|
||||||
if result == :ok do
|
if result == :ok do
|
||||||
Notification.create_notifications(object)
|
Notification.create_notifications(object)
|
||||||
|
|
||||||
Pleroma.Search.remove_from_index(deleted_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)
|
||||||
|
end
|
||||||
|
|
||||||
{:ok, object, meta}
|
{:ok, object, meta}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue