Merge pull request 'hashtag-timeline-fix' (#7938) from mkljczk/pleroma:hashtag-timeline-fix into develop

Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7938
This commit is contained in:
lain 2026-07-24 15:29:25 +00:00
commit a790e08a6c
3 changed files with 58 additions and 17 deletions

View file

@ -893,14 +893,22 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|> Repo.all()
# Note: NO extra ordering should be done on "activities.id desc nulls last" for optimal plan
from(
[_activity, object] in query,
join: hto in "hashtags_objects",
on: hto.object_id == object.id,
where: hto.hashtag_id in ^hashtag_ids,
distinct: [desc: object.id],
order_by: [desc: object.id]
)
query =
from(
[_activity, object] in query,
join: hto in "hashtags_objects",
on: hto.object_id == object.id,
where: hto.hashtag_id in ^hashtag_ids
)
if is_nil(query.distinct) do
from([_activity, object] in query,
distinct: [desc: object.id],
order_by: [desc: object.id]
)
else
query
end
end
defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do