tags
end
- defp hashtags_to_topics(%{data: %{"hashtags" => tags}}) do
- Enum.map(tags, fn tag -> "hashtag:" <> tag end)
- end
-
- defp hashtags_to_topics(%{data: %{"tag" => tags}}) do
- tags
- |> Enum.filter(&is_bitstring(&1))
+ defp hashtags_to_topics(object) do
+ object
+ |> Object.hashtags()
|> Enum.map(fn tag -> "hashtag:" <> tag end)
end
- defp hashtags_to_topics(_), do: []
-
defp remote_topics(%{local: true}), do: []
defp remote_topics(%{actor: actor}) when is_binary(actor),
def self_replies(object, opts \\ []),
do: replies(object, Keyword.put(opts, :self_only, true))
- def hashtags(%{"hashtags" => hashtags}), do: hashtags || []
- def hashtags(%{"tag" => tags}), do: Enum.filter(tags, &is_bitstring(&1))
+ def hashtags(%Object{data: %{"hashtags" => hashtags}}), do: hashtags || []
+ def hashtags(%Object{data: %{"tag" => tags}}), do: Enum.filter(tags, &is_bitstring(&1))
def hashtags(_), do: []
end
if MRF.subdomain_match?(media_nsfw, actor_host) do
child_object =
child_object
- |> Map.put("hashtags", Object.hashtags(child_object) ++ ["nsfw"])
+ |> Map.put("hashtags", Object.hashtags(%Object{data: child_object}) ++ ["nsfw"])
|> Map.put("sensitive", true)
Map.put(object, "object", child_object)
def add_hashtags(object) do
hashtags =
- object
+ %Object{data: object}
|> Object.hashtags()
|> Enum.map(fn tag ->
%{
%{
activity: activity,
+ object: object,
data: Map.get(object, :data),
actor: actor
}
media_attachments: attachments,
poll: render(PollView, "show.json", object: object, for: opts[:for]),
mentions: mentions,
- tags: build_tags(Object.hashtags(object.data)),
+ tags: build_tags(Object.hashtags(object)),
application: %{
name: "Web",
website: nil
<link type="text/html" href='<%= @data["external_url"] %>' rel="alternate"/>
<% end %>
- <%= for hashtag <- Object.hashtags(@data) do %>
+ <%= for hashtag <- Object.hashtags(@object) do %>
<category term="<%= hashtag %>"></category>
<% end %>
<link><%= @data["external_url"] %></link>
<% end %>
- <%= for hashtag <- Object.hashtags(@data) do %>
+ <%= for hashtag <- Object.hashtags(@object) do %>
<category term="<%= hashtag %>"></category>
<% end %>
<% end %>
<% end %>
- <%= for hashtag <- Object.hashtags(@data) do %>
+ <%= for hashtag <- Object.hashtags(@object) do %>
<category term="<%= hashtag %>"></category>
<% end %>