Merge branch 'fix/mutes.json-emptyarray' into 'develop'

Return empty array from /api/qvitter/mutes.json

See merge request pleroma/pleroma!234
This commit is contained in:
lambda 2018-06-25 08:45:42 +00:00
commit fc012491a5
3 changed files with 25 additions and 0 deletions

View file

@ -276,6 +276,7 @@ defmodule Pleroma.Web.Router do
get("/friendships/no_retweets/ids", TwitterAPI.Controller, :empty_array) get("/friendships/no_retweets/ids", TwitterAPI.Controller, :empty_array)
get("/mutes/users/ids", TwitterAPI.Controller, :empty_array) get("/mutes/users/ids", TwitterAPI.Controller, :empty_array)
get("/qvitter/mutes", TwitterAPI.Controller, :raw_empty_array)
get("/externalprofile/show", TwitterAPI.Controller, :external_profile) get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
end end

View file

@ -404,6 +404,10 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
json(conn, Jason.encode!([])) json(conn, Jason.encode!([]))
end end
def raw_empty_array(conn, _params) do
json(conn, [])
end
def update_profile(%{assigns: %{user: user}} = conn, params) do def update_profile(%{assigns: %{user: user}} = conn, params) do
params = params =
if bio = params["description"] do if bio = params["description"] do

View file

@ -491,6 +491,26 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
end end
end end
describe "GET /api/qvitter/mutes.json" do
setup [:valid_user]
test "unimplemented mutes without valid credentials", %{conn: conn} do
conn = get(conn, "/api/qvitter/mutes.json")
assert json_response(conn, 403) == %{"error" => "Invalid credentials."}
end
test "unimplemented mutes with credentials", %{conn: conn, user: current_user} do
conn =
conn
|> with_credentials(current_user.nickname, "test")
|> get("/api/qvitter/mutes.json")
current_user = Repo.get(User, current_user.id)
assert [] = json_response(conn, 200)
end
end
describe "POST /api/favorites/create/:id" do describe "POST /api/favorites/create/:id" do
setup [:valid_user] setup [:valid_user]