[#3213] Reinstated DISTINCT clause for hashtag "any" filtering with 2+ terms. Added test.
This commit is contained in:
parent
e7864a32d7
commit
380d0cce6b
3 changed files with 28 additions and 8 deletions
|
|
@ -846,11 +846,18 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
end
|
||||
|
||||
defp restrict_hashtag_any(query, %{tag: tags}) when is_list(tags) do
|
||||
from(
|
||||
[_activity, object] in query,
|
||||
join: hashtag in assoc(object, :hashtags),
|
||||
where: hashtag.name in ^tags
|
||||
)
|
||||
query =
|
||||
from(
|
||||
[_activity, object] in query,
|
||||
join: hashtag in assoc(object, :hashtags),
|
||||
where: hashtag.name in ^tags
|
||||
)
|
||||
|
||||
if length(tags) > 1 do
|
||||
distinct(query, [activity], true)
|
||||
else
|
||||
query
|
||||
end
|
||||
end
|
||||
|
||||
defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do
|
||||
|
|
|
|||
|
|
@ -134,9 +134,9 @@ defmodule Pleroma.Web.MastodonAPI.TimelineController do
|
|||
tags =
|
||||
[params[:tag], params[:any]]
|
||||
|> List.flatten()
|
||||
|> Enum.uniq()
|
||||
|> Enum.reject(&is_nil/1)
|
||||
|> Enum.map(&String.downcase/1)
|
||||
|> Enum.uniq()
|
||||
|
||||
tag_all =
|
||||
params
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue