- def make_poll_data(
- %{"poll" => %{"options" => options, "expires_in" => expires_in}} = data,
- mentions,
- tags
- )
- when is_list(options) and is_integer(expires_in) do
- content_type = get_content_type(data["content_type"])
- # XXX: There is probably a more performant/cleaner way to do this
- {poll, {mentions, tags}} =
- Enum.map_reduce(options, {mentions, tags}, fn option, {mentions, tags} ->
- # TODO: Custom emoji
- {option, mentions_merge, tags_merge} = format_input(option, content_type)
- mentions = mentions ++ mentions_merge
- tags = tags ++ tags_merge
-
- {%{
- "name" => option,
- "type" => "Note",
- "replies" => %{"type" => "Collection", "totalItems" => 0}
- }, {mentions, tags}}
- end)
+ def make_poll_data(%{"poll" => %{"options" => options, "expires_in" => expires_in}} = data)
+ when is_list(options) do
+ %{max_expiration: max_expiration, min_expiration: min_expiration} =
+ limits = Pleroma.Config.get([:instance, :poll_limits])