Poll View: Always return `voters_count`.
authorlain <lain@soykaf.club>
Wed, 4 Nov 2020 09:14:00 +0000 (10:14 +0100)
committerlain <lain@soykaf.club>
Wed, 4 Nov 2020 09:14:00 +0000 (10:14 +0100)
lib/pleroma/web/mastodon_api/views/poll_view.ex
test/pleroma/web/mastodon_api/views/poll_view_test.exs

index 1208dc9a053de85e959c0224d7460c6988ec7bd8..4101f21d03e35003a57a4a1b40e2a4cec52f571f 100644 (file)
@@ -19,7 +19,7 @@ defmodule Pleroma.Web.MastodonAPI.PollView do
       expired: expired,
       multiple: multiple,
       votes_count: votes_count,
-      voters_count: (multiple || nil) && voters_count(object),
+      voters_count: voters_count(object),
       options: options,
       voted: voted?(params),
       emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"])
index b7e2f17eff9faf85af39ba109f1ff0bc964d493e..c655ca438ff6351e4aca0488f8a60c3762408515 100644 (file)
@@ -44,7 +44,7 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
       ],
       voted: false,
       votes_count: 0,
-      voters_count: nil
+      voters_count: 0
     }
 
     result = PollView.render("show.json", %{object: object})