From 9bdea19d833cb3fa2dff4bad4f9083ed74085a89 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Fri, 30 Jun 2017 16:59:54 +0200 Subject: [PATCH] For non-create activities, grab the create activity to fav/rt --- lib/pleroma/web/twitter_api/twitter_api_controller.ex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index c16c76951..407a7931a 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -129,7 +129,12 @@ defmodule Pleroma.Web.TwitterAPI.Controller do end def get_by_id_or_ap_id(id) do - Repo.get(Activity, id) || Activity.get_create_activity_by_object_ap_id(id) + activity = Repo.get(Activity, id) || Activity.get_create_activity_by_object_ap_id(id) + if activity.data["type"] == "Create" do + activity + else + Activity.get_create_activity_by_object_ap_id(activity.data["object"]) + end end def favorite(%{assigns: %{user: user}} = conn, %{"id" => id}) do