"context" => draft.context,
"attachment" => draft.attachments,
"actor" => draft.user.ap_id,
- "tag" => Enum.filter(draft.tags, &is_map(&1)) |> Enum.uniq(),
- "hashtags" =>
- draft.tags
- |> Enum.reduce([], fn
- # Why so many formats
- {:name, x}, acc -> if is_bitstring(x), do: [x | acc], else: acc
- {"#" <> _, x}, acc -> if is_bitstring(x), do: [x | acc], else: acc
- x, acc -> if is_bitstring(x), do: [x | acc], else: acc
- end)
- |> Enum.uniq()
+ "tag" => Keyword.values(draft.tags) |> Enum.uniq()
}
|> add_in_reply_to(draft.in_reply_to)
|> Map.merge(draft.extra)
defp add_in_reply_to(object, nil), do: object
defp add_in_reply_to(object, in_reply_to) do
- with %Object{} = in_reply_to_object <- Object.normalize(in_reply_to) do
+ with %Object{} = in_reply_to_object <- Object.normalize(in_reply_to, fetch: false) do
Map.put(object, "inReplyTo", in_reply_to_object.data["id"])
else
_ -> object
%Activity{data: %{"to" => _to, "type" => type} = data} = activity
)
when type == "Create" do
- object = Object.normalize(activity, false)
+ object = Object.normalize(activity, fetch: false)
object_data =
cond do