From: Roger Braun Date: Sun, 19 Nov 2017 11:59:23 +0000 (+0100) Subject: MastoAPI: Only return create activties in contexts. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=c336a13d2c7cf873ef12c30973c833a2c53f4dff;p=akkoma MastoAPI: Only return create activties in contexts. --- diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex index a3587ff44..ca1e4c8d5 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -196,6 +196,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do with %Activity{} = activity <- Repo.get(Activity, id), activities <- ActivityPub.fetch_activities_for_context(activity.data["object"]["context"], %{"blocking_user" => user}), 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: StatusView.render("index.json", for: user, activities: grouped_activities[true] || [], as: :activity) |> Enum.reverse,