From: Ekaterina Vaartis Date: Wed, 18 Sep 2019 15:09:57 +0000 (+0300) Subject: Change path from nodeinfo to metadata->features X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=a1325d5fd9b540017cbffbb73db85ee9fa9f12d0;p=akkoma Change path from nodeinfo to metadata->features --- diff --git a/lib/pleroma/web/pleroma_api/emoji_api_controller.ex b/lib/pleroma/web/pleroma_api/emoji_api_controller.ex index bc1639095..391c317e7 100644 --- a/lib/pleroma/web/pleroma_api/emoji_api_controller.ex +++ b/lib/pleroma/web/pleroma_api/emoji_api_controller.ex @@ -152,7 +152,7 @@ keeping it in cache for #{div(cache_ms, 1000)}s") |> Tesla.get!() |> Map.get(:body) |> Jason.decode!() - |> Map.get("features") + |> get_in(["metadata", "features"]) |> Enum.member?("shareable_emoji_packs") if shareable_packs_available do diff --git a/test/web/emoji_api_controller_test.exs b/test/web/emoji_api_controller_test.exs index 1af4d3720..297dc092f 100644 --- a/test/web/emoji_api_controller_test.exs +++ b/test/web/emoji_api_controller_test.exs @@ -55,10 +55,10 @@ defmodule Pleroma.Web.PleromaAPI.EmojiAPIControllerTest do mock(fn %{method: :get, url: "https://old-instance/nodeinfo/2.1.json"} -> - json(%{features: []}) + json(%{metadata: %{features: []}}) %{method: :get, url: "https://example.com/nodeinfo/2.1.json"} -> - json(%{features: ["shareable_emoji_packs"]}) + json(%{metadata: %{features: ["shareable_emoji_packs"]}}) %{ method: :get,