Return object id in Ostatus create activties.
authorRoger Braun <roger@rogerbraun.net>
Fri, 21 Apr 2017 02:22:02 +0000 (04:22 +0200)
committerRoger Braun <roger@rogerbraun.net>
Fri, 21 Apr 2017 02:22:02 +0000 (04:22 +0200)
lib/pleroma/web/ostatus/activity_representer.ex
test/web/ostatus/activity_representer_test.exs

index 558c85df48d3cae3ec2a32a31bac6e57081032e3..6f101109c349b3bb22a459d416c26af364e347eb 100644 (file)
@@ -1,5 +1,5 @@
 defmodule Pleroma.Web.OStatus.ActivityRepresenter do
-  def to_simple_form(activity, user) do
+  def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user) do
     h = fn(str) -> [to_charlist(str)] end
 
     updated_at = activity.updated_at
@@ -10,7 +10,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
     [
       {:"activity:object-type", ['http://activitystrea.ms/schema/1.0/note']},
       {:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']},
-      {:id, h.(activity.data["id"])},
+      {:id, h.(activity.data["object"]["id"])},
       {:title, ['New note by #{user.nickname}']},
       {:content, [type: 'html'], h.(activity.data["object"]["content"])},
       {:published, h.(inserted_at)},
index 16a9d3b000f586c5d36c677127873d16a4111d34..de79717b1aed3ca06dc843f201fed68caa9da839 100644 (file)
@@ -18,7 +18,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
     expected = """
     <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
     <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
-    <id>#{note_activity.data["id"]}</id>
+    <id>#{note_activity.data["object"]["id"]}</id>
     <title>New note by #{user.nickname}</title>
     <content type="html">#{note_activity.data["object"]["content"]}</content>
     <published>#{inserted_at}</published>