aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-04-18 09:28:20 +0300
committerrinpatch <rinpatch@sdf.org>2019-04-18 09:28:20 +0300
commit6069d0fd361a9971f2297d3babc596d60634eb43 (patch)
tree7938f0f42c8cdeb22114adba5b0454d9af7d2629 /lib
parente31a22043bcf74d1d85f6fe007bd4606291d41e9 (diff)
downloadpleroma-6069d0fd361a9971f2297d3babc596d60634eb43.tar.gz
Fix object search depending on embeded object
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/visibility.ex4
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex6
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/visibility.ex b/lib/pleroma/web/activity_pub/visibility.ex
index 3da709b3d..6dee61dd6 100644
--- a/lib/pleroma/web/activity_pub/visibility.ex
+++ b/lib/pleroma/web/activity_pub/visibility.ex
@@ -41,7 +41,9 @@ defmodule Pleroma.Web.ActivityPub.Visibility do
# guard
def entire_thread_visible_for_user?(nil, _user), do: false
- # XXX: Probably even more inefficient than the previous implementation, intended to be a placeholder untill https://git.pleroma.social/pleroma/pleroma/merge_requests/971 is in develop
+ # XXX: Probably even more inefficient than the previous implementation intended to be a placeholder untill https://git.pleroma.social/pleroma/pleroma/merge_requests/971 is in develop
+ # credo:disable-for-previous-line Credo.Check.Readability.MaxLineLength
+
def entire_thread_visible_for_user?(
%Activity{} = tail,
# %Activity{data: %{"object" => %{"inReplyTo" => parent_id}}} = tail,
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index 4cec26c9b..3916d7c41 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -1012,13 +1012,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
q =
from(
- a in Activity,
+ [a, o] in Activity.with_preloaded_object(Activity),
where: fragment("?->>'type' = 'Create'", a.data),
where: "https://www.w3.org/ns/activitystreams#Public" in a.recipients,
where:
fragment(
- "to_tsvector('english', ?->'object'->>'content') @@ plainto_tsquery('english', ?)",
- a.data,
+ "to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?)",
+ o.data,
^query
),
limit: 20,