Fix leftovers
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
eb72248e16
commit
7f7bf025e7
@ -520,7 +520,8 @@ defmodule Mobilizon.Events do
|
|||||||
|> events_for_tags(args)
|
|> events_for_tags(args)
|
||||||
|> events_for_location(args)
|
|> events_for_location(args)
|
||||||
|> filter_local_or_from_followed_instances_events()
|
|> filter_local_or_from_followed_instances_events()
|
||||||
|> order_by([q], asc: q.id)
|
|> filter_public_visibility()
|
||||||
|
|> event_order_begins_on_asc()
|
||||||
|> Page.build_page(page, limit)
|
|> Page.build_page(page, limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1339,21 +1340,12 @@ defmodule Mobilizon.Events do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@spec events_for_search_query(String.t()) :: Ecto.Query.t()
|
@spec events_for_search_query(String.t()) :: Ecto.Query.t()
|
||||||
|
defp events_for_search_query(""), do: Event
|
||||||
|
|
||||||
defp events_for_search_query(search_string) do
|
defp events_for_search_query(search_string) do
|
||||||
Event
|
from(event in Event,
|
||||||
|> where([e], e.visibility == ^:public)
|
|
||||||
|> distinct([e], e.id)
|
|
||||||
|> do_event_for_search_query(search_string)
|
|
||||||
end
|
|
||||||
|
|
||||||
@spec do_event_for_search_query(Ecto.Query.t(), String.t()) :: Ecto.Query.t()
|
|
||||||
defp do_event_for_search_query(query, ""), do: query
|
|
||||||
|
|
||||||
defp do_event_for_search_query(query, search_string) do
|
|
||||||
from(event in query,
|
|
||||||
join: id_and_rank in matching_event_ids_and_ranks(search_string),
|
join: id_and_rank in matching_event_ids_and_ranks(search_string),
|
||||||
on: id_and_rank.id == event.id,
|
on: id_and_rank.id == event.id
|
||||||
order_by: [desc: id_and_rank.rank]
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user