Make error message about author's inability to vote more sensible

This commit is contained in:
rinpatch 2019-06-02 23:30:36 +03:00
부모 c47da0e65d
커밋 2fe3a20638
2개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제

파일 보기

@ -144,7 +144,7 @@ defmodule Pleroma.Web.CommonAPI do
object = Object.get_cached_by_ap_id(object.data["id"])
{:ok, answer_activities, object}
else
{:author, _} -> {:error, "Already voted"}
{:author, _} -> {:error, "Poll's author can't vote"}
{:existing_votes, _} -> {:error, "Already voted"}
{:choice_check, {_, false}} -> {:error, "Invalid indices"}
{:count_check, false} -> {:error, "Too many choices"}

파일 보기

@ -3649,7 +3649,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert conn
|> assign(:user, user)
|> 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)