diff --git a/config/config.exs b/config/config.exs index 5fced7029..417f298d7 100644 --- a/config/config.exs +++ b/config/config.exs @@ -152,12 +152,12 @@ config :pleroma, Pleroma.Web.Endpoint, config :logger, truncate: 65536 config :logger, :console, - level: :debug, + level: :info, format: "\n$time $metadata[$level] $message\n", metadata: [:request_id] config :logger, :ex_syslogger, - level: :debug, + level: :info, ident: "pleroma", format: "$metadata[$level] $message", metadata: [:request_id] diff --git a/lib/pleroma/search/builtin.ex b/lib/pleroma/search/builtin.ex index 019713f52..3cbe2207a 100644 --- a/lib/pleroma/search/builtin.ex +++ b/lib/pleroma/search/builtin.ex @@ -14,6 +14,7 @@ defmodule Pleroma.Search.Builtin do def search(_conn, %{q: query} = params, options) do version = Keyword.get(options, :version) timeout = Keyword.get(Repo.config(), :timeout, 15_000) + query = String.trim(query) default_values = %{"statuses" => [], "accounts" => [], "hashtags" => []} default_values diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index b43929891..756096952 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1321,7 +1321,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do fetch_activities_query_ap_ids_ops(opts) config = %{ - skip_thread_containment: true + skip_thread_containment: Config.get([:instance, :skip_thread_containment]) } query = diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index 637db3840..6a8360def 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -543,7 +543,6 @@ defmodule Pleroma.Web.ActivityPub.Utils do end def get_latest_reaction(internal_activity_id, %{ap_id: ap_id}, emoji) do - IO.inspect(emoji) %{data: %{"object" => object_ap_id}} = Activity.get_by_id(internal_activity_id) emoji = Pleroma.Emoji.maybe_quote(emoji) diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex index d1d9363a7..1de02faf8 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex @@ -61,6 +61,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiReactionController do |> Stream.map(fn [emoji, users, url] when is_list(users) -> filter_emoji.(emoji, users, url) {emoji, users, url} when is_list(users) -> filter_emoji.(emoji, users, url) + {emoji, users} when is_list(users) -> filter_emoji.(emoji, users, nil) _ -> nil end) |> Stream.reject(&is_nil/1) diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index a4dd8e99a..49ddf251d 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -130,7 +130,7 @@ defmodule Pleroma.ReverseProxyTest do assert capture_log(fn -> ReverseProxy.call(conn, "/stream-bytes/50", max_body_length: 30) end) =~ - "[warn] Elixir.Pleroma.ReverseProxy request to /stream-bytes/50 failed while reading/chunking: :body_too_large" + "Elixir.Pleroma.ReverseProxy request to /stream-bytes/50 failed while reading/chunking: :body_too_large" end end diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index c6155ed18..82d43555f 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -158,7 +158,7 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do object = Object.get_by_ap_id(emoji_react.data["object"]) assert object.data["reaction_count"] == 1 - assert ["👌", [user.ap_id]] in object.data["reactions"] + assert ["👌", [user.ap_id], nil] in object.data["reactions"] end test "creates a notification", %{emoji_react: emoji_react, poster: poster} do diff --git a/test/pleroma/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs index 99cc7bbd0..642b05f3f 100644 --- a/test/pleroma/web/admin_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/report_controller_test.exs @@ -360,7 +360,13 @@ defmodule Pleroma.Web.AdminAPI.ReportControllerTest do response = json_response_and_validate_schema(conn, 200) notes = hd(response["reports"])["notes"] - [note, _] = notes + assert 2 == Enum.count(notes) + + note = + notes + |> Enum.find(fn note -> note["content"] == "this is disgusting!" end) + + refute is_nil(note) assert note["user"]["nickname"] == admin.nickname assert note["content"] == "this is disgusting!" diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index fc01f820a..c4f506fe3 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -309,7 +309,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do assert capture_log(fn -> assert Utils.date_to_asctime(date) == expected - end) =~ "[warn] Date #{date} in wrong format, must be ISO 8601" + end) =~ "[warning] Date #{date} in wrong format, must be ISO 8601" end test "when date is a Unix timestamp" do @@ -319,7 +319,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do assert capture_log(fn -> assert Utils.date_to_asctime(date) == expected - end) =~ "[warn] Date #{date} in wrong format, must be ISO 8601" + end) =~ "[warning] Date #{date} in wrong format, must be ISO 8601" end test "when date is nil" do @@ -327,13 +327,13 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do assert capture_log(fn -> assert Utils.date_to_asctime(nil) == expected - end) =~ "[warn] Date in wrong format, must be ISO 8601" + end) =~ "[warning] Date in wrong format, must be ISO 8601" end test "when date is a random string" do assert capture_log(fn -> assert Utils.date_to_asctime("foo") == "" - end) =~ "[warn] Date foo in wrong format, must be ISO 8601" + end) =~ "[warning] Date foo in wrong format, must be ISO 8601" end end 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 e31cd0291..d0387412c 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -323,7 +323,6 @@ 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 diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs index 9dfdf8bf0..3ee53d95c 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -34,16 +34,25 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do {:ok, activity} = CommonAPI.post(user, %{status: "dae cofe??"}) {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, "☕") + {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, ":dinosaur:") {:ok, _} = CommonAPI.react_with_emoji(activity.id, third_user, "🍵") {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕") + {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, ":dinosaur:") + activity = Repo.get(Activity, activity.id) status = StatusView.render("show.json", activity: activity) assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec()) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 2, me: false}, - %{name: "🍵", count: 1, me: false} + %{name: "☕", count: 2, me: false, url: nil}, + %{ + count: 2, + me: false, + name: "dinosaur", + url: "http://localhost:4001/emoji/dino walking.gif" + }, + %{name: "🍵", count: 1, me: false, url: nil} ] status = StatusView.render("show.json", activity: activity, for: user) @@ -51,8 +60,14 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do assert_schema(status, "Status", Pleroma.Web.ApiSpec.spec()) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 2, me: true}, - %{name: "🍵", count: 1, me: false} + %{name: "☕", count: 2, me: true, url: nil}, + %{ + count: 2, + me: true, + name: "dinosaur", + url: "http://localhost:4001/emoji/dino walking.gif" + }, + %{name: "🍵", count: 1, me: false, url: nil} ] end @@ -65,11 +80,10 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do |> Object.update_data(%{"reactions" => %{"☕" => [user.ap_id], "x" => 1}}) activity = Activity.get_by_id(activity.id) - status = StatusView.render("show.json", activity: activity, for: user) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 1, me: true} + %{name: "☕", count: 1, me: true, url: nil} ] end @@ -89,7 +103,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do status = StatusView.render("show.json", activity: activity) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 1, me: false} + %{name: "☕", count: 1, me: false, url: nil} ] status = StatusView.render("show.json", activity: activity, for: user) @@ -101,19 +115,19 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do status = StatusView.render("show.json", activity: activity) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 2, me: false} + %{name: "☕", count: 2, me: false, url: nil} ] status = StatusView.render("show.json", activity: activity, for: user) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 1, me: false} + %{name: "☕", count: 1, me: false, url: nil} ] status = StatusView.render("show.json", activity: activity, for: other_user) assert status[:pleroma][:emoji_reactions] == [ - %{name: "☕", count: 1, me: true} + %{name: "☕", count: 1, me: true, url: nil} ] end diff --git a/test/pleroma/web/metadata/providers/open_graph_test.exs b/test/pleroma/web/metadata/providers/open_graph_test.exs index 28ca8839c..d15db20e2 100644 --- a/test/pleroma/web/metadata/providers/open_graph_test.exs +++ b/test/pleroma/web/metadata/providers/open_graph_test.exs @@ -144,7 +144,7 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do [ property: "og:image", content: - "http://localhost:4001/proxy/preview/LzAnlke-l5oZbNzWsrHfprX1rGw/aHR0cHM6Ly9wbGVyb21hLmdvdi9hYm91dC9qdWNoZS53ZWJt/juche.webm" + "http://localhost:4001/proxy/preview/FElXD3PfapZSKq-u62Dc3BiaIM8/aHR0cHM6Ly9wbGVyb21hLmdvdi9hYm91dC9qdWNoZS53ZWJt/juche.webm" ], []} in result end