Include own_votes in the poll data

This commit is contained in:
Mark Felder 2021-01-22 09:47:59 -06:00
commit 6bfd497f4a
3 changed files with 27 additions and 7 deletions

View file

@ -44,7 +44,8 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
],
voted: false,
votes_count: 0,
voters_count: 0
voters_count: 0,
own_votes: []
}
result = PollView.render("show.json", %{object: object})
@ -123,7 +124,10 @@ defmodule Pleroma.Web.MastodonAPI.PollViewTest do
result = PollView.render("show.json", %{object: object, for: other_user})
_own_votes = result[:own_votes]
assert result[:voted] == true
assert own_votes = [1, 2]
assert Enum.at(result[:options], 1)[:votes_count] == 1
assert Enum.at(result[:options], 2)[:votes_count] == 1
end