"actor" => user.ap_id,
"tag" => [],
"id" => "https://pleroma.gov/objects/whatever",
+ "summary" => "",
"content" => "pleroma in a nutshell"
}
})
] == result
end
+ test "it uses summary as description if post has one" do
+ user = insert(:user, name: "Jimmy Hendriks", bio: "born 19 March 1994")
+ {:ok, activity} = CommonAPI.post(user, %{status: "HI"})
+
+ note =
+ insert(:note, %{
+ data: %{
+ "actor" => user.ap_id,
+ "tag" => [],
+ "id" => "https://pleroma.gov/objects/whatever",
+ "summary" => "Public service announcement on caffeine consumption",
+ "content" => "cofe"
+ }
+ })
+
+ result = TwitterCard.build_tags(%{object: note, user: user, activity_id: activity.id})
+
+ assert [
+ {:meta, [property: "twitter:title", content: Utils.user_name_string(user)], []},
+ {:meta,
+ [
+ property: "twitter:description",
+ content: "Public service announcement on caffeine consumption"
+ ], []},
+ {:meta, [property: "twitter:image", content: "http://localhost:4001/images/avi.png"],
+ []},
+ {:meta, [property: "twitter:card", content: "summary"], []}
+ ] == result
+ end
+
test "it renders avatar not attachment if post is nsfw and unfurl_nsfw is disabled" do
clear_config([Pleroma.Web.Metadata, :unfurl_nsfw], false)
user = insert(:user, name: "Jimmy Hendriks", bio: "born 19 March 1994")
"actor" => user.ap_id,
"tag" => [],
"id" => "https://pleroma.gov/objects/whatever",
+ "summary" => "",
"content" => "pleroma in a nutshell",
"sensitive" => true,
"attachment" => [
"actor" => user.ap_id,
"tag" => [],
"id" => "https://pleroma.gov/objects/whatever",
+ "summary" => "",
"content" => "pleroma in a nutshell",
"attachment" => [
%{