poll_view: try to read votersCount first, and then manually count local voters.

This commit is contained in:
Yonle 2026-05-05 13:49:29 +07:00
commit aec0deef8b
No known key found for this signature in database
GPG key ID: 11889F326F523287

View file

@ -71,12 +71,12 @@ defmodule Pleroma.Web.MastodonAPI.PollView do
end)
end
defp voters_count(%{data: %{"votersCount" => voters}}), do: voters
defp voters_count(%{data: %{"voters" => [_ | _] = voters}}) do
length(voters)
end
defp voters_count(%{data: %{"votersCount" => voters}}), do: voters
defp voters_count(_), do: 0
defp voted_and_own_votes(%{object: object} = params, options) do