Make error message about author's inability to vote more sensible
This commit is contained in:
parent
c47da0e65d
commit
2fe3a20638
@ -144,7 +144,7 @@ def vote(user, object, choices) do
|
|||||||
object = Object.get_cached_by_ap_id(object.data["id"])
|
object = Object.get_cached_by_ap_id(object.data["id"])
|
||||||
{:ok, answer_activities, object}
|
{:ok, answer_activities, object}
|
||||||
else
|
else
|
||||||
{:author, _} -> {:error, "Already voted"}
|
{:author, _} -> {:error, "Poll's author can't vote"}
|
||||||
{:existing_votes, _} -> {:error, "Already voted"}
|
{:existing_votes, _} -> {:error, "Already voted"}
|
||||||
{:choice_check, {_, false}} -> {:error, "Invalid indices"}
|
{:choice_check, {_, false}} -> {:error, "Invalid indices"}
|
||||||
{:count_check, false} -> {:error, "Too many choices"}
|
{:count_check, false} -> {:error, "Too many choices"}
|
||||||
|
@ -3649,7 +3649,7 @@ test "author can't vote", %{conn: conn} do
|
|||||||
assert conn
|
assert conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/v1/polls/#{object.id}/votes", %{"choices" => [1]})
|
|> post("/api/v1/polls/#{object.id}/votes", %{"choices" => [1]})
|
||||||
|> json_response(422) == %{"error" => "Already voted"}
|
|> json_response(422) == %{"error" => "Poll's author can't vote"}
|
||||||
|
|
||||||
object = Object.get_by_id(object.id)
|
object = Object.get_by_id(object.id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user