From 1299bccc7de1562775de23245bf9922c16329e9a Mon Sep 17 00:00:00 2001 From: Vivian Lim Date: Sat, 23 Jun 2018 23:20:30 -0700 Subject: [PATCH] return unquoted empty array from /api/qvitter/mutes.json --- lib/pleroma/web/router.ex | 2 +- lib/pleroma/web/twitter_api/twitter_api_controller.ex | 4 ++++ test/web/twitter_api/twitter_api_controller_test.exs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index b65850aaa..4ebb2c368 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -269,7 +269,7 @@ def user_fetcher(username) do get("/friendships/no_retweets/ids", TwitterAPI.Controller, :empty_array) get("/mutes/users/ids", TwitterAPI.Controller, :empty_array) - get("/qvitter/mutes", TwitterAPI.Controller, :empty_array) + get("/qvitter/mutes", TwitterAPI.Controller, :raw_empty_array) get("/externalprofile/show", TwitterAPI.Controller, :external_profile) end diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index ff5921807..8f5b3c786 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -404,6 +404,10 @@ def empty_array(conn, _params) do json(conn, Jason.encode!([])) end + def raw_empty_array(conn, _params) do + json(conn, []) + end + def update_profile(%{assigns: %{user: user}} = conn, params) do params = if bio = params["description"] do diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index edc8cbff8..5fcd23d90 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -506,7 +506,7 @@ test "unimplemented mutes with credentials", %{conn: conn, user: current_user} d |> get("/api/qvitter/mutes.json") current_user = Repo.get(User, current_user.id) - assert "[]" = json_response(conn, 200) + assert [] = json_response(conn, 200) end end