Fix multiple-choice poll detection

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-06-15 00:30:45 +02:00
commit 4644a8bd10
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
3 changed files with 19 additions and 11 deletions

View file

@ -28,10 +28,10 @@ defmodule Pleroma.Web.MastodonAPI.PollView do
def render("show.json", %{object: object} = params) do
case object.data do
%{"anyOf" => options} when is_list(options) ->
%{"anyOf" => options} when is_list(options) and options != [] ->
render(__MODULE__, "show.json", Map.merge(params, %{multiple: true, options: options}))
%{"oneOf" => options} when is_list(options) ->
%{"oneOf" => options} when is_list(options) and options != [] ->
render(__MODULE__, "show.json", Map.merge(params, %{multiple: false, options: options}))
_ ->