alias Ecto.{Changeset, UUID}
import Ecto.Query
+ def make_json_ld_header do
+ %{
+ "@context" => [
+ "https://www.w3.org/ns/activitystreams",
+ "https://w3id.org/security/v1",
+ %{
+ "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
+ "sensitive" => "as:sensitive",
+ "Hashtag" => "as:Hashtag",
+ "ostatus" => "http://ostatus.org#",
+ "atomUri" => "ostatus:atomUri",
+ "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
+ "conversation" => "ostatus:conversation",
+ "toot" => "http://joinmastodon.org/ns#",
+ "Emoji" => "toot:Emoji"
+ }
+ ]
+ }
+ end
+
def make_date do
DateTime.utc_now() |> DateTime.to_iso8601
end
@doc """
Inserts a full object if it is contained in an activity.
"""
- def insert_full_object(%{"object" => object_data}) when is_map(object_data) do
+ def insert_full_object(%{"object" => %{"type" => type} = object_data}) when is_map(object_data) and type in ["Note"] do
with {:ok, _} <- Object.create(object_data) do
:ok
end
"actor" => ap_id,
"object" => id,
"to" => [actor.follower_address, object.data["actor"]],
+ "cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"context" => object.data["context"]
}
"type" => "Follow",
"actor" => follower_id,
"to" => [followed_id],
+ "cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"object" => followed_id
}
"actor" => ap_id,
"object" => id,
"to" => [user.follower_address, object.data["actor"]],
+ "cc" => ["https://www.w3.org/ns/activitystreams#Public"],
"context" => object.data["context"]
}