2022-01-20 05:48:16 -07:00
|
|
|
# Akkoma: A lightweight social networking server
|
|
|
|
# Copyright © 2022-2022 Akkoma Authors <https://git.ihatebeinga.live/IHBAGang/akkoma/>
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-12-11 10:36:49 -07:00
|
|
|
defmodule Pleroma.Elasticsearch.DocumentMappings.Activity do
|
|
|
|
alias Pleroma.Object
|
|
|
|
|
|
|
|
def id(obj), do: obj.id
|
2021-12-12 10:23:44 -07:00
|
|
|
|
|
|
|
def encode(%{object: %{data: %{"type" => "Note"}}} = activity) do
|
2021-12-11 10:36:49 -07:00
|
|
|
%{
|
2021-12-12 10:23:44 -07: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 10:36:49 -07:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|