summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/notification_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-04-01 19:49:09 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-04-01 19:49:09 +0300
commit2f2bd7fe72f474b7177c751a2dc3af716622ba91 (patch)
tree0f09b03ec1e06b25200571628f8bd0dac17d7e3d /test/web/mastodon_api/controllers/notification_controller_test.exs
parentbfec45bf740f9fcfcea92bbded6bd2c146dc64c1 (diff)
downloadpleroma-2f2bd7fe72f474b7177c751a2dc3af716622ba91.tar.gz
pleroma-2f2bd7fe72f474b7177c751a2dc3af716622ba91.zip
Ability to control the output of account/pleroma/relationship in statuses in order to improve the rendering performance.
See `[:extensions, output_relationships_in_statuses_by_default]` setting and `with_relationships` param.
Diffstat (limited to 'test/web/mastodon_api/controllers/notification_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/notification_controller_test.exs20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/web/mastodon_api/controllers/notification_controller_test.exs b/test/web/mastodon_api/controllers/notification_controller_test.exs
index 7a0011646..42a311f99 100644
--- a/test/web/mastodon_api/controllers/notification_controller_test.exs
+++ b/test/web/mastodon_api/controllers/notification_controller_test.exs
@@ -12,6 +12,26 @@ defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do
import Pleroma.Factory
+ test "does NOT render account/pleroma/relationship if this is disabled by default" do
+ clear_config([:extensions, :output_relationships_in_statuses_by_default], false)
+
+ %{user: user, conn: conn} = oauth_access(["read:notifications"])
+ other_user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(other_user, %{"status" => "hi @#{user.nickname}"})
+ {:ok, [_notification]} = Notification.create_notifications(activity)
+
+ response =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/notifications")
+ |> json_response(200)
+
+ assert Enum.all?(response, fn n ->
+ get_in(n, ["account", "pleroma", "relationship"]) == %{}
+ end)
+ end
+
test "list of notifications" do
%{user: user, conn: conn} = oauth_access(["read:notifications"])
other_user = insert(:user)