diff options
author | lain <lain@soykaf.club> | 2020-07-30 12:41:47 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-30 12:41:47 +0000 |
commit | 873ff5ce1402ae6138f4a66dd0d71c462c0b1ece (patch) | |
tree | 9c717d08dc65e33b3757f38c8bc37c6ad89b2616 /test | |
parent | d39b72c8fa8b338d6afd02af3d0870ccca391aba (diff) | |
parent | 00d090004eefdf6cf2cf644be1d4dcfdd8b0ba35 (diff) | |
download | pleroma-873ff5ce1402ae6138f4a66dd0d71c462c0b1ece.tar.gz pleroma-873ff5ce1402ae6138f4a66dd0d71c462c0b1ece.zip |
Merge branch 'hide-reactions' into 'develop'
Let favourites and emoji reactions optionally be hidden
See merge request pleroma/pleroma!2804
Diffstat (limited to 'test')
-rw-r--r-- | test/web/mastodon_api/controllers/status_controller_test.exs | 14 | ||||
-rw-r--r-- | test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs | 17 |
2 files changed, 31 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs index d34f300da..5955d8334 100644 --- a/test/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/web/mastodon_api/controllers/status_controller_test.exs @@ -1432,6 +1432,20 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do [%{"id" => id}] = response assert id == other_user.id end + + test "returns empty array when :show_reactions is disabled", %{conn: conn, activity: activity} do + clear_config([:instance, :show_reactions], false) + + other_user = insert(:user) + {:ok, _} = CommonAPI.favorite(other_user, activity.id) + + response = + conn + |> get("/api/v1/statuses/#{activity.id}/favourited_by") + |> json_response_and_validate_schema(:ok) + + assert Enum.empty?(response) + end end describe "GET /api/v1/statuses/:id/reblogged_by" do diff --git a/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs index e1bb5ebfe..3deab30d1 100644 --- a/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs +++ b/test/web/pleroma_api/controllers/emoji_reaction_controller_test.exs @@ -106,6 +106,23 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionControllerTest do result end + test "GET /api/v1/pleroma/statuses/:id/reactions with :show_reactions disabled", %{conn: conn} do + clear_config([:instance, :show_reactions], false) + + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{status: "#cofe"}) + {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅") + + result = + conn + |> get("/api/v1/pleroma/statuses/#{activity.id}/reactions") + |> json_response_and_validate_schema(200) + + assert result == [] + end + test "GET /api/v1/pleroma/statuses/:id/reactions/:emoji", %{conn: conn} do user = insert(:user) other_user = insert(:user) |