Preload thread mutes/bookmarks in get_context

Also removes filtering for creates (was done on the database side
already) and filtering for the requested activity (moved to the database
side) from application side.
This commit is contained in:
rinpatch 2019-08-14 02:36:54 +03:00
commit f4e087ee48
2 changed files with 11 additions and 5 deletions

View file

@ -497,12 +497,9 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
activities <-
ActivityPub.fetch_activities_for_context(activity.data["context"], %{
"blocking_user" => user,
"user" => user
"user" => user,
"exclude_id" => activity.id
}),
activities <-
activities |> Enum.filter(fn %{id: aid} -> to_string(aid) != to_string(id) end),
activities <-
activities |> Enum.filter(fn %{data: %{"type" => type}} -> type == "Create" end),
grouped_activities <- Enum.group_by(activities, fn %{id: id} -> id < activity.id end) do
result = %{
ancestors: