Output conversation id.
authorRoger Braun <roger@rogerbraun.net>
Wed, 26 Apr 2017 06:47:22 +0000 (08:47 +0200)
committerRoger Braun <roger@rogerbraun.net>
Wed, 26 Apr 2017 06:47:22 +0000 (08:47 +0200)
lib/pleroma/web/ostatus/activity_representer.ex
lib/pleroma/web/ostatus/feed_representer.ex
test/support/factory.ex
test/web/ostatus/activity_representer_test.exs
test/web/ostatus/feed_representer_test.exs

index 590abc8bbbad3cfc7135f6b9936466a2520671b1..367212fe142bd662a48057c1451afbcc6ea9c70d 100644 (file)
@@ -19,7 +19,9 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
       {:title, ['New note by #{user.nickname}']},
       {:content, [type: 'html'], h.(activity.data["object"]["content"])},
       {:published, h.(inserted_at)},
-      {:updated, h.(updated_at)}
+      {:updated, h.(updated_at)},
+      {:"ostatus:conversation", [], h.(activity.data["context"])},
+      {:link, [href: h.(activity.data["context"]), rel: 'ostatus:conversation'], []}
     ] ++ attachments
   end
 
index 2cc0da9baf554d7577a706fe9256a73a0c9deb40..10a1ffb259674cb22a31245f1c1274259f42d081 100644 (file)
@@ -17,7 +17,8 @@ defmodule Pleroma.Web.OStatus.FeedRepresenter do
       :feed, [
         xmlns: 'http://www.w3.org/2005/Atom',
         "xmlns:activity": 'http://activitystrea.ms/spec/1.0/',
-        "xmlns:poco": 'http://portablecontacts.net/spec/1.0'
+        "xmlns:poco": 'http://portablecontacts.net/spec/1.0',
+        "xmlns:ostatus": 'http://ostatus.org/schema/1.0'
       ], [
         {:id, h.(OStatus.feed_path(user))},
         {:title, ['#{user.nickname}\'s timeline']},
index d7c16f0e0997edd92e609a4bdf00032064ef1d21..d037be4a622a5fba90d6b8076ddbe1d5a86eca35 100644 (file)
@@ -24,7 +24,8 @@ defmodule Pleroma.Factory do
       "to" => ["https://www.w3.org/ns/activitystreams#Public"],
       "published_at" => DateTime.utc_now() |> DateTime.to_iso8601,
       "likes" => [],
-      "like_count" => 0
+      "like_count" => 0,
+      "context" => "2hu"
     }
 
     %Pleroma.Object{
@@ -40,7 +41,8 @@ defmodule Pleroma.Factory do
       "actor" => note.data["actor"],
       "to" => note.data["to"],
       "object" => note.data,
-      "published_at" => DateTime.utc_now() |> DateTime.to_iso8601
+      "published_at" => DateTime.utc_now() |> DateTime.to_iso8601,
+      "context" => note.data["context"]
     }
 
     %Pleroma.Activity{
index 61df41a1d56772c014e66c2369130463cba6c6e2..10f9a9d0bd5ca4bc62a4f7be4a36778adae174ec 100644 (file)
@@ -23,6 +23,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do
     <content type="html">#{note_activity.data["object"]["content"]}</content>
     <published>#{inserted_at}</published>
     <updated>#{updated_at}</updated>
+    <ostatus:conversation>#{note_activity.data["context"]}</ostatus:conversation>
+    <link href="#{note_activity.data["context"]}" rel="ostatus:conversation" />
     """
 
     tuple = ActivityRepresenter.to_simple_form(note_activity, user)
index 13cdeb79d357cdf4ee813c69bd875351e30b3b10..ef0f4d5fffe3a50ff27e79afdd477b3893c9b30c 100644 (file)
@@ -22,7 +22,7 @@ defmodule Pleroma.Web.OStatus.FeedRepresenterTest do
     |> :xmerl.export_simple_content(:xmerl_xml)
 
     expected = """
-    <feed xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:poco="http://portablecontacts.net/spec/1.0">
+    <feed xmlns="http://www.w3.org/2005/Atom" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0">
       <id>#{OStatus.feed_path(user)}</id>
       <title>#{user.nickname}'s timeline</title>
       <updated>#{most_recent_update}</updated>