For non-create activities, grab the create activity to fav/rt
authorRoger Braun <roger@rogerbraun.net>
Fri, 30 Jun 2017 14:59:54 +0000 (16:59 +0200)
committerRoger Braun <roger@rogerbraun.net>
Fri, 30 Jun 2017 14:59:54 +0000 (16:59 +0200)
lib/pleroma/web/twitter_api/twitter_api_controller.ex

index c16c76951f7fec095edddfe4a1c40237f1a969d0..407a7931a7dc4619428e5e18f26f73aeedfb2d3b 100644 (file)
@@ -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