From 466568ae36fd247e635e5a1c4db2b5662eda1d02 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 5 May 2022 11:18:18 -0400 Subject: [PATCH] Lint Ref: fix-local-public --- lib/pleroma/activity/search.ex | 5 ++++- .../mastodon_api/controllers/search_controller_test.exs | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/activity/search.ex b/lib/pleroma/activity/search.ex index b56d4a5aa..0b9b24aa4 100644 --- a/lib/pleroma/activity/search.ex +++ b/lib/pleroma/activity/search.ex @@ -58,7 +58,10 @@ defmodule Pleroma.Activity.Search do def maybe_restrict_blocked(query, _), do: query defp restrict_public(q, user) when not is_nil(user) do - intended_recipients = [Pleroma.Constants.as_public(), Pleroma.Web.ActivityPub.Utils.as_local_public()] + intended_recipients = [ + Pleroma.Constants.as_public(), + Pleroma.Web.ActivityPub.Utils.as_local_public() + ] from([a, o] in q, where: fragment("?->>'type' = 'Create'", a.data), 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 e6599866e..9a5d88109 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -83,7 +83,8 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do user = insert(:user) %{conn: conn} = oauth_access(["read:search"]) - {:ok, activity} = CommonAPI.post(user, %{status: "This is about 2hu private 天子", visibility: "local"}) + {:ok, activity} = + CommonAPI.post(user, %{status: "This is about 2hu private 天子", visibility: "local"}) results = conn @@ -98,7 +99,8 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do user = insert(:user) %{conn: conn} = oauth_access([]) - {:ok, _activity} = CommonAPI.post(user, %{status: "This is about 2hu private 天子", visibility: "local"}) + {:ok, _activity} = + CommonAPI.post(user, %{status: "This is about 2hu private 天子", visibility: "local"}) results = conn @@ -111,7 +113,8 @@ defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do test "search local-only status as an anonymous user" do user = insert(:user) - {:ok, _activity} = CommonAPI.post(user, %{status: "This is about 2hu private 天子", visibility: "local"}) + {:ok, _activity} = + CommonAPI.post(user, %{status: "This is about 2hu private 天子", visibility: "local"}) results = build_conn()