akkoma/lib/pleroma/elasticsearch/document_mappings/activity.ex

16 lines
441 B
Elixir
Raw Normal View History

2021-12-11 17:36:49 +00:00
defmodule Pleroma.Elasticsearch.DocumentMappings.Activity do
alias Pleroma.Object
def id(obj), do: obj.id
2021-12-12 17:23:44 +00:00
def encode(%{object: %{data: %{"type" => "Note"}}} = activity) do
2021-12-11 17:36:49 +00:00
%{
2021-12-12 17:23:44 +00:00
_timestamp: activity.inserted_at,
user: activity.user_actor.nickname,
content: activity.object.data["content"],
instance: URI.parse(activity.user_actor.ap_id).host,
hashtags: Object.hashtags(activity.object)
2021-12-11 17:36:49 +00:00
}
end
end