ostatus: use Object.normalize() instead of Object.get_by_ap_id() directly.
authorWilliam Pitcock <nenolod@dereferenced.org>
Mon, 18 Jun 2018 21:08:37 +0000 (21:08 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Wed, 27 Jun 2018 13:07:45 +0000 (13:07 +0000)
lib/pleroma/web/ostatus/handlers/delete_handler.ex
lib/pleroma/web/ostatus/ostatus.ex

index 4f3016b65ac1501e0adc7c18a5c41822cba533a6..6330d7f64cd2dc153a5b9d04bc31f9afd619b8e8 100644 (file)
@@ -6,7 +6,7 @@ defmodule Pleroma.Web.OStatus.DeleteHandler do
 
   def handle_delete(entry, _doc \\ nil) do
     with id <- XML.string_from_xpath("//id", entry),
-         object when not is_nil(object) <- Object.get_by_ap_id(id),
+         %Object{} = object <- Object.normalize(id),
          {:ok, delete} <- ActivityPub.delete(object, false) do
       delete
     end
index f0ff0624fcab1f69b2369ed355bcd3423f75959b..916c894eb9a80a9338f2643d60eb0950bd000b68 100644 (file)
@@ -89,7 +89,7 @@ defmodule Pleroma.Web.OStatus do
 
   def make_share(entry, doc, retweeted_activity) do
     with {:ok, actor} <- find_make_or_update_user(doc),
-         %Object{} = object <- Object.get_by_ap_id(retweeted_activity.data["object"]["id"]),
+         %Object{} = object <- Object.normalize(retweeted_activity.data["object"]),
          id when not is_nil(id) <- string_from_xpath("/entry/id", entry),
          {:ok, activity, _object} = ActivityPub.announce(actor, object, id, false) do
       {:ok, activity}
@@ -107,7 +107,7 @@ defmodule Pleroma.Web.OStatus do
 
   def make_favorite(entry, doc, favorited_activity) do
     with {:ok, actor} <- find_make_or_update_user(doc),
-         %Object{} = object <- Object.get_by_ap_id(favorited_activity.data["object"]["id"]),
+         %Object{} = object <- Object.normalize(favorited_activity.data["object"]),
          id when not is_nil(id) <- string_from_xpath("/entry/id", entry),
          {:ok, activity, _object} = ActivityPub.like(actor, object, id, false) do
       {:ok, activity}