Commit 2e89d505 authored by lain's avatar lain
Browse files

Connect attachments with objects, not activities.

parent 6aa1523b
...@@ -17,7 +17,7 @@ def to_map(%Activity{} = activity, %{user: user} = opts) do ...@@ -17,7 +17,7 @@ def to_map(%Activity{} = activity, %{user: user} = opts) do
"created_at" => published, "created_at" => published,
"in_reply_to_status_id" => activity.data["object"]["inReplyToStatusId"], "in_reply_to_status_id" => activity.data["object"]["inReplyToStatusId"],
"statusnet_conversation_id" => activity.data["object"]["statusnetConversationId"], "statusnet_conversation_id" => activity.data["object"]["statusnetConversationId"],
"attachments" => (activity.data["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts) "attachments" => (activity.data["object"]["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts)
} }
end end
end end
...@@ -24,11 +24,11 @@ def create_status(user = %User{}, data = %{}) do ...@@ -24,11 +24,11 @@ def create_status(user = %User{}, data = %{}) do
"type" => "Note", "type" => "Note",
"content" => data["status"], "content" => data["status"],
"published" => date, "published" => date,
"context" => context "context" => context,
"attachment" => attachments
}, },
"published" => date, "published" => date,
"context" => context, "context" => context
"attachment" => attachments
} }
# Wire up reply info. # Wire up reply info.
......
...@@ -33,16 +33,16 @@ test "an activity" do ...@@ -33,16 +33,16 @@ test "an activity" do
User.ap_followers(user), User.ap_followers(user),
"https://www.w3.org/ns/activitystreams#Public" "https://www.w3.org/ns/activitystreams#Public"
], ],
"attachment" => [
object
],
"actor" => User.ap_id(user), "actor" => User.ap_id(user),
"object" => %{ "object" => %{
"published" => date, "published" => date,
"type" => "Note", "type" => "Note",
"content" => content, "content" => content,
"inReplyToStatusId" => 213123, "inReplyToStatusId" => 213123,
"statusnetConversationId" => 4711 "statusnetConversationId" => 4711,
"attachment" => [
object
]
}, },
"published" => date "published" => date
} }
......
...@@ -40,7 +40,7 @@ test "create a status" do ...@@ -40,7 +40,7 @@ test "create a status" do
assert get_in(activity.data, ["object", "statusnetConversationId"]) == activity.id assert get_in(activity.data, ["object", "statusnetConversationId"]) == activity.id
assert get_in(activity.data, ["statusnetConversationId"]) == activity.id assert get_in(activity.data, ["statusnetConversationId"]) == activity.id
assert is_list(activity.data["attachment"]) assert is_list(activity.data["object"]["attachment"])
end end
test "create a status that is a reply" do test "create a status that is a reply" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment