Also index incoming federated posts
This commit is contained in:
parent
e35d87ea54
commit
2b2e409ad7
4 changed files with 29 additions and 11 deletions
|
|
@ -197,6 +197,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
# - Increase replies count
|
||||
# - Set up ActivityExpiration
|
||||
# - Set up notifications
|
||||
# - Index incoming posts for search (if needed)
|
||||
@impl true
|
||||
def handle(%{data: %{"type" => "Create"}} = activity, meta) do
|
||||
with {:ok, object, meta} <- handle_object_creation(meta[:object_data], activity, meta),
|
||||
|
|
@ -226,6 +227,8 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
Task.start(fn -> Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) end)
|
||||
end)
|
||||
|
||||
Pleroma.Search.add_to_index(Map.put(activity, :object, object))
|
||||
|
||||
meta =
|
||||
meta
|
||||
|> add_notifications(notifications)
|
||||
|
|
@ -286,6 +289,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
# - Reduce the user note count
|
||||
# - Reduce the reply count
|
||||
# - Stream out the activity
|
||||
# - Removes posts from search index (if needed)
|
||||
@impl true
|
||||
def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object, meta) do
|
||||
deleted_object =
|
||||
|
|
@ -325,6 +329,9 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
|
|||
|
||||
if result == :ok do
|
||||
Notification.create_notifications(object)
|
||||
|
||||
Pleroma.Search.remove_from_index(object)
|
||||
|
||||
{:ok, object, meta}
|
||||
else
|
||||
{:error, result}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue