MastoAPI: Only return create activties in contexts.
authorRoger Braun <roger@rogerbraun.net>
Sun, 19 Nov 2017 11:59:23 +0000 (12:59 +0100)
committerRoger Braun <roger@rogerbraun.net>
Sun, 19 Nov 2017 11:59:23 +0000 (12:59 +0100)
lib/pleroma/web/mastodon_api/mastodon_api_controller.ex

index a3587ff4459b4cc7e7c9130f72dc4e3b1077f9ef..ca1e4c8d5e6d2b0eaaae8f2c7b95d70e5ec22f53 100644 (file)
@@ -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,