summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-11-04 14:44:45 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2020-11-04 14:44:45 +0000
commit9c09ea01aa8c93e02b5697e27f0a8458b624b161 (patch)
tree3e382255b517dc66facae145646353f792a48747 /lib
parentbc4d9c4ffc9ccd826220893a97ce695e4bb66f9d (diff)
parent92d252f364ed421f2afcdd135507ced3554eb3f0 (diff)
downloadpleroma-9c09ea01aa8c93e02b5697e27f0a8458b624b161.tar.gz
pleroma-9c09ea01aa8c93e02b5697e27f0a8458b624b161.zip
Merge branch '2284-voters-count' into 'develop'
Always return voters_count in polls See merge request pleroma/pleroma!3120
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/api_spec/schemas/poll.ex9
-rw-r--r--lib/pleroma/web/mastodon_api/views/poll_view.ex2
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/pleroma/web/api_spec/schemas/poll.ex b/lib/pleroma/web/api_spec/schemas/poll.ex
index c62096db0..0dfa60b97 100644
--- a/lib/pleroma/web/api_spec/schemas/poll.ex
+++ b/lib/pleroma/web/api_spec/schemas/poll.ex
@@ -28,8 +28,11 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
},
votes_count: %Schema{
type: :integer,
- nullable: true,
- description: "How many votes have been received. Number, or null if `multiple` is false."
+ description: "How many votes have been received. Number."
+ },
+ voters_count: %Schema{
+ type: :integer,
+ description: "How many unique accounts have voted. Number."
},
voted: %Schema{
type: :boolean,
@@ -61,7 +64,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
expired: true,
multiple: false,
votes_count: 10,
- voters_count: nil,
+ voters_count: 10,
voted: true,
own_votes: [
1
diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex
index 1208dc9a0..4101f21d0 100644
--- a/lib/pleroma/web/mastodon_api/views/poll_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex
@@ -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"])