From 24bf8c39775993add581c74a594e675b79452cf7 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sat, 11 Jun 2022 16:14:31 +0100 Subject: [PATCH] mix format --- lib/pleroma/emoji.ex | 1 - lib/pleroma/http.ex | 1 + .../object_validators/emoji_react_validator.ex | 2 ++ test/pleroma/http_test.exs | 1 + .../transmogrifier/emoji_react_handling_test.exs | 12 +++++++++++- .../controllers/search_controller_test.exs | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex index a3e7e5353..d421f2ccb 100644 --- a/lib/pleroma/emoji.ex +++ b/lib/pleroma/emoji.ex @@ -164,5 +164,4 @@ defmodule Pleroma.Emoji do end def maybe_quote(name), do: name - end diff --git a/lib/pleroma/http.ex b/lib/pleroma/http.ex index 87bdb663e..07b3ab0ae 100644 --- a/lib/pleroma/http.ex +++ b/lib/pleroma/http.ex @@ -69,6 +69,7 @@ defmodule Pleroma.HTTP do adapter = Application.get_env(:tesla, :adapter) client = Tesla.client(adapter_middlewares(adapter), adapter) + maybe_limit( fn -> request(client, request) diff --git a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex index b133cbb74..995395826 100644 --- a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex @@ -96,9 +96,11 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactValidator do else tag = get_field(cng, :tag) emoji_name = Emoji.stripped_name(content) + case tag do [%{name: ^emoji_name, type: "Emoji", icon: %{url: _}}] -> cng + _ -> cng |> add_error(:tag, "does not contain an Emoji tag") diff --git a/test/pleroma/http_test.exs b/test/pleroma/http_test.exs index cd537729a..e8a2538d3 100644 --- a/test/pleroma/http_test.exs +++ b/test/pleroma/http_test.exs @@ -10,6 +10,7 @@ defmodule Pleroma.HTTPTest do setup do clear_config([:http, :send_user_agent], false) + mock(fn %{ method: :get, diff --git a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs index c262ebbc2..4ab1d29e3 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs @@ -73,7 +73,17 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do object = Object.get_by_ap_id(data["object"]) assert object.data["reaction_count"] == 1 - assert match?([["hanapog", _, "https://misskey.local.live/files/webpublic-8f8a9768-7264-4171-88d6-2356aabeadcd"]], object.data["reactions"]) + + assert match?( + [ + [ + "hanapog", + _, + "https://misskey.local.live/files/webpublic-8f8a9768-7264-4171-88d6-2356aabeadcd" + ] + ], + object.data["reactions"] + ) end test "it reject invalid emoji reactions" do diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs index d0387412c..e31cd0291 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -323,6 +323,7 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do |> assign(:token, insert(:oauth_token, user: user, scopes: ["read"])) |> get("/api/v1/search?#{query}") |> json_response_and_validate_schema(200) + [account] = results["accounts"] assert account["acct"] == "mike@osada.macgirvin.com" end