forked from AkkomaGang/akkoma
Merge branch '2284-voters-count' into 'develop'
Always return voters_count in polls See merge request pleroma/pleroma!3120
This commit is contained in:
commit
9c09ea01aa
4 changed files with 9 additions and 5 deletions
|
@ -30,6 +30,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.
|
- 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).
|
- 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`.
|
- 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>
|
<details>
|
||||||
<summary>API Changes</summary>
|
<summary>API Changes</summary>
|
||||||
|
|
|
@ -28,8 +28,11 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
||||||
},
|
},
|
||||||
votes_count: %Schema{
|
votes_count: %Schema{
|
||||||
type: :integer,
|
type: :integer,
|
||||||
nullable: true,
|
description: "How many votes have been received. Number."
|
||||||
description: "How many votes have been received. Number, or null if `multiple` is false."
|
},
|
||||||
|
voters_count: %Schema{
|
||||||
|
type: :integer,
|
||||||
|
description: "How many unique accounts have voted. Number."
|
||||||
},
|
},
|
||||||
voted: %Schema{
|
voted: %Schema{
|
||||||
type: :boolean,
|
type: :boolean,
|
||||||
|
@ -61,7 +64,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Poll do
|
||||||
expired: true,
|
expired: true,
|
||||||
multiple: false,
|
multiple: false,
|
||||||
votes_count: 10,
|
votes_count: 10,
|
||||||
voters_count: nil,
|
voters_count: 10,
|
||||||
voted: true,
|
voted: true,
|
||||||
own_votes: [
|
own_votes: [
|
||||||
1
|
1
|
||||||
|
|
|
@ -19,7 +19,7 @@ def render("show.json", %{object: object, multiple: multiple, options: options}
|
||||||
expired: expired,
|
expired: expired,
|
||||||
multiple: multiple,
|
multiple: multiple,
|
||||||
votes_count: votes_count,
|
votes_count: votes_count,
|
||||||
voters_count: (multiple || nil) && voters_count(object),
|
voters_count: voters_count(object),
|
||||||
options: options,
|
options: options,
|
||||||
voted: voted?(params),
|
voted: voted?(params),
|
||||||
emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"])
|
emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"])
|
||||||
|
|
|
@ -44,7 +44,7 @@ test "renders a poll" do
|
||||||
],
|
],
|
||||||
voted: false,
|
voted: false,
|
||||||
votes_count: 0,
|
votes_count: 0,
|
||||||
voters_count: nil
|
voters_count: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
result = PollView.render("show.json", %{object: object})
|
result = PollView.render("show.json", %{object: object})
|
||||||
|
|
Loading…
Reference in a new issue