- "to" => to,
- "cc" => cc,
- "content" => content_html,
- "summary" => summary,
- "sensitive" => truthy_param?(sensitive),
- "context" => context,
- "attachment" => attachments,
- "actor" => actor,
- "tag" => Keyword.values(tags) |> Enum.uniq()
+ "to" => draft.to,
+ "cc" => draft.cc,
+ "content" => draft.content_html,
+ "summary" => draft.summary,
+ "sensitive" => draft.sensitive,
+ "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()