Add categories to ostatus output.
This commit is contained in:
parent
36ec998dd7
commit
8e02fa100f
|
@ -42,6 +42,9 @@ def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user,
|
|||
author = if with_author, do: [{:author, UserRepresenter.to_simple_form(user)}], else: []
|
||||
mentions = activity.data["to"] |> get_mentions
|
||||
|
||||
categories = (activity.data["object"]["tag"] || [])
|
||||
|> Enum.map(fn (tag) -> {:category, [term: to_charlist(tag)], []} end)
|
||||
|
||||
[
|
||||
{:"activity:object-type", ['http://activitystrea.ms/schema/1.0/note']},
|
||||
{:"activity:verb", ['http://activitystrea.ms/schema/1.0/post']},
|
||||
|
@ -53,7 +56,7 @@ def to_simple_form(%{data: %{"object" => %{"type" => "Note"}}} = activity, user,
|
|||
{:"ostatus:conversation", [], h.(activity.data["context"])},
|
||||
{:link, [href: h.(activity.data["context"]), rel: 'ostatus:conversation'], []},
|
||||
{:link, [type: ['application/atom+xml'], href: h.(activity.data["object"]["id"]), rel: 'self'], []}
|
||||
] ++ attachments ++ in_reply_to ++ author ++ mentions
|
||||
] ++ categories ++ attachments ++ in_reply_to ++ author ++ mentions
|
||||
end
|
||||
|
||||
def to_simple_form(%{data: %{"type" => "Like"}} = activity, user, with_author) do
|
||||
|
|
|
@ -25,7 +25,8 @@ def note_factory do
|
|||
"published_at" => DateTime.utc_now() |> DateTime.to_iso8601,
|
||||
"likes" => [],
|
||||
"like_count" => 0,
|
||||
"context" => "2hu"
|
||||
"context" => "2hu",
|
||||
"tag" => ["2hu"]
|
||||
}
|
||||
|
||||
%Pleroma.Object{
|
||||
|
|
|
@ -27,6 +27,7 @@ test "a note activity" do
|
|||
<ostatus:conversation>#{note_activity.data["context"]}</ostatus:conversation>
|
||||
<link href="#{note_activity.data["context"]}" rel="ostatus:conversation" />
|
||||
<link type="application/atom+xml" href="#{note_activity.data["object"]["id"]}" rel="self" />
|
||||
<category term="2hu"/>
|
||||
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/collection" href="http://activityschema.org/collection/public"/>
|
||||
"""
|
||||
|
||||
|
|
Loading…
Reference in New Issue