From 2fe3a20638789a8fb6e1a8e63cd5eb2247a9308a Mon Sep 17 00:00:00 2001 From: rinpatch Date: Sun, 2 Jun 2019 23:30:36 +0300 Subject: [PATCH] Make error message about author's inability to vote more sensible --- lib/pleroma/web/common_api/common_api.ex | 2 +- test/web/mastodon_api/mastodon_api_controller_test.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index a12ee011b..5212d5ce5 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -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"} diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs index 9c1db37db..c158c4df2 100644 --- a/test/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/web/mastodon_api/mastodon_api_controller_test.exs @@ -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) -- 2.45.2