Left join, not inner
Some checks are pending
ci/woodpecker/push/woodpecker Pipeline is pending

This commit is contained in:
FloatingGhost 2022-12-04 20:19:38 +00:00
parent c71e1e1e51
commit 9427ebf70e

View file

@ -946,13 +946,15 @@ defp restrict_recipients_or_hashtags(query, recipients, user, []) do
end end
defp restrict_recipients_or_hashtags(query, recipients, _user, hashtag_ids) do defp restrict_recipients_or_hashtags(query, recipients, _user, hashtag_ids) do
from( from([activity, object] in query)
[activity, object] in query, |> join(:left, [activity, object], hto in "hashtags_objects",
join: hto in "hashtags_objects",
on: hto.object_id == object.id, on: hto.object_id == object.id,
where: as: :hto
(hto.hashtag_id in ^hashtag_ids and ^Constants.as_public() in activity.recipients) or )
fragment("? && ?", ^recipients, activity.recipients) |> where(
[activity, object, hto: hto],
(hto.hashtag_id in ^hashtag_ids and ^Constants.as_public() in activity.recipients) or
fragment("? && ?", ^recipients, activity.recipients)
) )
end end