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
defp restrict_recipients_or_hashtags(query, recipients, _user, hashtag_ids) do
from(
[activity, object] in query,
join: hto in "hashtags_objects",
from([activity, object] in query)
|> join(:left, [activity, object], hto in "hashtags_objects",
on: hto.object_id == object.id,
where:
(hto.hashtag_id in ^hashtag_ids and ^Constants.as_public() in activity.recipients) or
fragment("? && ?", ^recipients, activity.recipients)
as: :hto
)
|> where(
[activity, object, hto: hto],
(hto.hashtag_id in ^hashtag_ids and ^Constants.as_public() in activity.recipients) or
fragment("? && ?", ^recipients, activity.recipients)
)
end