From a6812bc9dff96a600558c534ee24ed176a8eea28 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 30 Nov 2018 16:47:37 +0100 Subject: [PATCH] Remove "most recent notification" endpoint. --- lib/pleroma/web/router.ex | 6 ------ .../web/twitter_api/twitter_api_controller.ex | 14 ------------- .../twitter_api_controller_test.exs | 20 ------------------- 3 files changed, 40 deletions(-) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 462369806..a8468ea12 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -265,12 +265,6 @@ defmodule Pleroma.Web.Router do post("/account/update_profile_banner", TwitterAPI.Controller, :update_banner) post("/qvitter/update_background_image", TwitterAPI.Controller, :update_background) - post( - "/account/most_recent_notification", - TwitterAPI.Controller, - :update_most_recent_notification - ) - get("/statuses/home_timeline", TwitterAPI.Controller, :friends_timeline) get("/statuses/friends_timeline", TwitterAPI.Controller, :friends_timeline) get("/statuses/mentions", TwitterAPI.Controller, :mentions_timeline) diff --git a/lib/pleroma/web/twitter_api/twitter_api_controller.ex b/lib/pleroma/web/twitter_api/twitter_api_controller.ex index cd0e2121c..8a5cf5fcd 100644 --- a/lib/pleroma/web/twitter_api/twitter_api_controller.ex +++ b/lib/pleroma/web/twitter_api/twitter_api_controller.ex @@ -350,20 +350,6 @@ def external_profile(%{assigns: %{user: current_user}} = conn, %{"profileurl" => end end - def update_most_recent_notification(%{assigns: %{user: user}} = conn, %{"id" => id}) do - with id when is_number(id) <- String.to_integer(id), - info <- user.info, - mrn <- max(id, user.info["most_recent_notification"] || 0), - updated_info <- Map.put(info, "most_recent_notification", mrn), - changeset <- User.info_changeset(user, %{info: updated_info}), - {:ok, _user} <- User.update_and_set_cache(changeset) do - conn - |> json_reply(200, Jason.encode!(mrn)) - else - _e -> bad_request_reply(conn, "Can't update.") - end - end - def followers(conn, params) do with {:ok, user} <- TwitterAPI.get_user(conn.assigns[:user], params), {:ok, followers} <- User.get_followers(user) do diff --git a/test/web/twitter_api/twitter_api_controller_test.exs b/test/web/twitter_api/twitter_api_controller_test.exs index 6bdcb4fd8..9062f1c4e 100644 --- a/test/web/twitter_api/twitter_api_controller_test.exs +++ b/test/web/twitter_api/twitter_api_controller_test.exs @@ -31,26 +31,6 @@ test "with credentials", %{conn: conn, user: user} do end end - describe "POST /api/account/most_recent_notification" do - setup [:valid_user] - - test "without valid credentials", %{conn: conn} do - conn = post(conn, "/api/account/most_recent_notification.json") - assert json_response(conn, 403) == %{"error" => "Invalid credentials."} - end - - test "with credentials", %{conn: conn, user: user} do - conn = - conn - |> with_credentials(user.nickname, "test") - |> post("/api/account/most_recent_notification.json", %{id: "200"}) - - assert json_response(conn, 200) - user = User.get_by_nickname(user.nickname) - assert user.info["most_recent_notification"] == 200 - end - end - describe "POST /statuses/update.json" do setup [:valid_user]