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