+ defp get_links(%{local: true, data: data}) do
+ h = fn(str) -> [to_charlist(str)] end
+ [
+ {:link, [type: ['application/atom+xml'], href: h.(data["object"]["id"]), rel: 'self'], []},
+ {:link, [type: ['text/html'], href: h.(data["object"]["id"]), rel: 'alternate'], []}
+ ]
+ end
+
+ defp get_links(%{local: false,
+ data: %{
+ "object" => %{
+ "external_url" => external_url
+ }
+ }}) do
+
+ h = fn(str) -> [to_charlist(str)] end
+ [
+ {:link, [type: ['text/html'], href: h.(external_url), rel: 'alternate'], []}
+ ]
+ end
+
+ defp get_links(_activity), do: []
+