X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fmastodon_api%2Fviews%2Fpoll_view.ex;h=aa6443754f1b31ac440159b2aae02fd6a2d2fe70;hb=fc842aa7c78fb0380708dfecf2e7a515f66ec815;hp=de536c8fb6959a6c5f31abdeaf2a16210f4d88f6;hpb=3f3d64acbfe0f8219911cb053e7fdab25137a23a;p=akkoma diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex index de536c8fb..aa6443754 100644 --- a/lib/pleroma/web/mastodon_api/views/poll_view.ex +++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex @@ -25,7 +25,7 @@ defmodule Pleroma.Web.MastodonAPI.PollView do } if params[:for] do - # if a user is not authenticated Mastodon doesn't include `voted` & `own_votes` keys in response + # when unauthenticated Mastodon doesn't include `voted` & `own_votes` keys in response {voted, own_votes} = voted_and_own_votes(params, options) Map.merge(poll, %{voted: voted, own_votes: own_votes}) else @@ -68,7 +68,7 @@ defmodule Pleroma.Web.MastodonAPI.PollView do end) end - defp voters_count(%{data: %{"voters" => [_ | _] = voters}}) do + defp voters_count(%{data: %{"voters" => voters}}) when is_list(voters) do length(voters) end