EmojiReactions: Remove old API endpoints
authorLain Soykaf <lain@soykaf.club>
Fri, 7 Feb 2020 14:01:45 +0000 (15:01 +0100)
committerLain Soykaf <lain@soykaf.club>
Fri, 7 Feb 2020 14:01:45 +0000 (15:01 +0100)
lib/pleroma/web/router.ex
test/web/pleroma_api/controllers/pleroma_api_controller_test.exs

index c1680092787332137cf9909ba4f6750d090d9bb7..89721569826113d8f1b2b3106bfd3f9fb9a9f8a8 100644 (file)
@@ -271,7 +271,6 @@ defmodule Pleroma.Web.Router do
   scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
     pipe_through(:api)
 
-    get("/statuses/:id/emoji_reactions_by", PleromaAPIController, :emoji_reactions_by)
     get("/statuses/:id/reactions", PleromaAPIController, :emoji_reactions_by)
   end
 
@@ -288,8 +287,6 @@ defmodule Pleroma.Web.Router do
       pipe_through(:authenticated_api)
 
       patch("/conversations/:id", PleromaAPIController, :update_conversation)
-      post("/statuses/:id/react_with_emoji", PleromaAPIController, :react_with_emoji)
-      post("/statuses/:id/unreact_with_emoji", PleromaAPIController, :unreact_with_emoji)
       put("/statuses/:id/reactions/:emoji", PleromaAPIController, :react_with_emoji)
       delete("/statuses/:id/reactions/:emoji", PleromaAPIController, :unreact_with_emoji)
       post("/notifications/read", PleromaAPIController, :read_notification)
index c9da9037796e6831fd2b42dd73c17a07e1564c8d..36868db38c9f96a28a8bd0ec2aa9865aea257e57 100644 (file)
@@ -14,27 +14,6 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
 
   import Pleroma.Factory
 
-  test "POST /api/v1/pleroma/statuses/:id/react_with_emoji", %{conn: conn} do
-    user = insert(:user)
-    other_user = insert(:user)
-
-    {:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
-
-    result =
-      conn
-      |> assign(:user, other_user)
-      |> assign(:token, insert(:oauth_token, user: other_user, scopes: ["write:statuses"]))
-      |> post("/api/v1/pleroma/statuses/#{activity.id}/react_with_emoji", %{"emoji" => "☕"})
-      |> json_response(200)
-
-    assert %{"id" => id} = result
-    assert to_string(activity.id) == id
-
-    assert result["pleroma"]["emoji_reactions"] == [
-             %{"name" => "☕", "count" => 1, "me" => true}
-           ]
-  end
-
   test "PUT /api/v1/pleroma/statuses/:id/reactions/:emoji", %{conn: conn} do
     user = insert(:user)
     other_user = insert(:user)
@@ -57,27 +36,6 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
            ]
   end
 
-  test "POST /api/v1/pleroma/statuses/:id/unreact_with_emoji", %{conn: conn} do
-    user = insert(:user)
-    other_user = insert(:user)
-
-    {:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
-    {:ok, activity, _object} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
-
-    result =
-      conn
-      |> assign(:user, other_user)
-      |> assign(:token, insert(:oauth_token, user: other_user, scopes: ["write:statuses"]))
-      |> post("/api/v1/pleroma/statuses/#{activity.id}/unreact_with_emoji", %{"emoji" => "☕"})
-
-    assert %{"id" => id} = json_response(result, 200)
-    assert to_string(activity.id) == id
-
-    object = Object.normalize(activity)
-
-    assert object.data["reaction_count"] == 0
-  end
-
   test "DELETE /api/v1/pleroma/statuses/:id/reactions/:emoji", %{conn: conn} do
     user = insert(:user)
     other_user = insert(:user)
@@ -99,45 +57,6 @@ defmodule Pleroma.Web.PleromaAPI.PleromaAPIControllerTest do
     assert object.data["reaction_count"] == 0
   end
 
-  test "GET /api/v1/pleroma/statuses/:id/emoji_reactions_by", %{conn: conn} do
-    user = insert(:user)
-    other_user = insert(:user)
-    doomed_user = insert(:user)
-
-    {:ok, activity} = CommonAPI.post(user, %{"status" => "#cofe"})
-
-    result =
-      conn
-      |> get("/api/v1/pleroma/statuses/#{activity.id}/emoji_reactions_by")
-      |> json_response(200)
-
-    assert result == []
-
-    {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
-    {:ok, _, _} = CommonAPI.react_with_emoji(activity.id, doomed_user, "🎅")
-
-    User.perform(:delete, doomed_user)
-
-    result =
-      conn
-      |> get("/api/v1/pleroma/statuses/#{activity.id}/emoji_reactions_by")
-      |> json_response(200)
-
-    [%{"name" => "🎅", "count" => 1, "accounts" => [represented_user], "me" => false}] = result
-
-    assert represented_user["id"] == other_user.id
-
-    result =
-      conn
-      |> assign(:user, other_user)
-      |> assign(:token, insert(:oauth_token, user: other_user, scopes: ["read:statuses"]))
-      |> get("/api/v1/pleroma/statuses/#{activity.id}/emoji_reactions_by")
-      |> json_response(200)
-
-    assert [%{"name" => "🎅", "count" => 1, "accounts" => [_represented_user], "me" => true}] =
-             result
-  end
-
   test "GET /api/v1/pleroma/statuses/:id/reactions", %{conn: conn} do
     user = insert(:user)
     other_user = insert(:user)