From b91ccef2371fb0bbc23638b174e815dd7189482e Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 26 Apr 2017 08:47:22 +0200 Subject: [PATCH] Output conversation id. --- lib/pleroma/web/ostatus/activity_representer.ex | 4 +++- lib/pleroma/web/ostatus/feed_representer.ex | 3 ++- test/support/factory.ex | 6 ++++-- test/web/ostatus/activity_representer_test.exs | 2 ++ test/web/ostatus/feed_representer_test.exs | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/ostatus/activity_representer.ex b/lib/pleroma/web/ostatus/activity_representer.ex index 590abc8bb..367212fe1 100644 --- a/lib/pleroma/web/ostatus/activity_representer.ex +++ b/lib/pleroma/web/ostatus/activity_representer.ex @@ -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 diff --git a/lib/pleroma/web/ostatus/feed_representer.ex b/lib/pleroma/web/ostatus/feed_representer.ex index 2cc0da9ba..10a1ffb25 100644 --- a/lib/pleroma/web/ostatus/feed_representer.ex +++ b/lib/pleroma/web/ostatus/feed_representer.ex @@ -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']}, diff --git a/test/support/factory.ex b/test/support/factory.ex index d7c16f0e0..d037be4a6 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -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{ diff --git a/test/web/ostatus/activity_representer_test.exs b/test/web/ostatus/activity_representer_test.exs index 61df41a1d..10f9a9d0b 100644 --- a/test/web/ostatus/activity_representer_test.exs +++ b/test/web/ostatus/activity_representer_test.exs @@ -23,6 +23,8 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenterTest do #{note_activity.data["object"]["content"]} #{inserted_at} #{updated_at} + #{note_activity.data["context"]} + """ tuple = ActivityRepresenter.to_simple_form(note_activity, user) diff --git a/test/web/ostatus/feed_representer_test.exs b/test/web/ostatus/feed_representer_test.exs index 13cdeb79d..ef0f4d5ff 100644 --- a/test/web/ostatus/feed_representer_test.exs +++ b/test/web/ostatus/feed_representer_test.exs @@ -22,7 +22,7 @@ defmodule Pleroma.Web.OStatus.FeedRepresenterTest do |> :xmerl.export_simple_content(:xmerl_xml) expected = """ - + #{OStatus.feed_path(user)} #{user.nickname}'s timeline #{most_recent_update}