ソースを参照

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

tags/v1.1.4
rinpatch 5年前
コミット
2fe3a20638
2個のファイルの変更2行の追加2行の削除
  1. +1
    -1
      lib/pleroma/web/common_api/common_api.ex
  2. +1
    -1
      test/web/mastodon_api/mastodon_api_controller_test.exs

+ 1
- 1
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"}


+ 1
- 1
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)



読み込み中…
キャンセル
保存