- # Groups by all bindings to allow aggregation on hashtags
- defp group_by_all_bindings(query) do
- # Expecting named bindings: :object, :bookmark, :thread_mute, :report_note
- cond do
- Enum.count(query.aliases) == 4 ->
- from([a, o, b3, b4, b5] in query, group_by: [a.id, o.id, b3.id, b4.id, b5.id])
-
- Enum.count(query.aliases) == 3 ->
- from([a, o, b3, b4] in query, group_by: [a.id, o.id, b3.id, b4.id])
-
- Enum.count(query.aliases) == 2 ->
- from([a, o, b3] in query, group_by: [a.id, o.id, b3.id])
-
- true ->
- from([a, o] in query, group_by: [a.id, o.id])
- end
- end
-
- defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do