note
|> Map.put(:data, data)
- user = User.get_cached_by_ap_id(note.data["actor"])
+ User.get_cached_by_ap_id(note.data["actor"])
status = StatusView.render("status.json", %{activity: note})
visibility: "public",
media_attachments: [],
mentions: [],
- tags: [],
+ tags: [
+ %{
+ name: "#{note.data["object"]["tag"]}",
+ url: "/tag/#{note.data["object"]["tag"]}"
+ }
+ ],
application: %{
name: "Web",
website: nil
assert represented[:reblog][:id] == to_string(activity.id)
assert represented[:emojis] == []
end
+
+ describe "build_tags/1" do
+ test "it returns a a dictionary tags" do
+ object_tags = [
+ "fediverse",
+ "mastodon",
+ "nextcloud",
+ %{
+ "href" => "https://kawen.space/users/lain",
+ "name" => "@lain@kawen.space",
+ "type" => "Mention"
+ }
+ ]
+
+ assert StatusView.build_tags(object_tags) == [
+ %{name: "fediverse", url: "/tag/fediverse"},
+ %{name: "mastodon", url: "/tag/mastodon"},
+ %{name: "nextcloud", url: "/tag/nextcloud"}
+ ]
+ end
+ end
end