Merge branch 'restrict-domain' into 'develop'
authorlain <lain@soykaf.club>
Wed, 4 Nov 2020 14:54:53 +0000 (14:54 +0000)
committerlain <lain@soykaf.club>
Wed, 4 Nov 2020 14:54:53 +0000 (14:54 +0000)
View a remote server's timeline

See merge request pleroma/pleroma!2713

CHANGELOG.md
lib/pleroma/web/api_spec/schemas/poll.ex
lib/pleroma/web/mastodon_api/views/poll_view.ex
test/pleroma/web/mastodon_api/views/poll_view_test.exs

index 8358eb9da81be3039711c03e1d986445ffe1cc70..73c2e13222e12393b9db55b42ba80a803d9e516b 100644 (file)
@@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Users with the `discoverable` field set to false will not show up in searches.
 - Minimum lifetime for ephmeral activities changed to 10 minutes and made configurable (`:min_lifetime` option).
 - Introduced optional dependencies on `ffmpeg`, `ImageMagick`, `exiftool` software packages. Please refer to `docs/installation/optional/media_graphics_packages.md`.
+- Polls now always return a `voters_count`, even if they are single-choice
 
 <details>
   <summary>API Changes</summary>
index c62096db0e302af6b21a2fa8d0f0282cc0b40335..0dfa60b9705fe87bc9da2667c2dec99b525177bf 100644 (file)
@@ -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
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})