Make error message about author's inability to vote more sensible
authorrinpatch <rinpatch@sdf.org>
Sun, 2 Jun 2019 20:30:36 +0000 (23:30 +0300)
committerrinpatch <rinpatch@sdf.org>
Sun, 2 Jun 2019 20:33:15 +0000 (23:33 +0300)
lib/pleroma/web/common_api/common_api.ex
test/web/mastodon_api/mastodon_api_controller_test.exs

index a12ee011bef12711c75ce0871ec60f700fcb4063..5212d5ce522cae22479ff7d8486d5f4709f66391 100644 (file)
@@ -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"}
index 9c1db37dbfe156564f01849c5d04727732a8c5e7..c158c4df28d44ec1e7783bfd1339db65437370c4 100644 (file)
@@ -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)