mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-22 07:52:43 +00:00
Fix leftovers
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
eb72248e16
commit
7f7bf025e7
1 changed files with 6 additions and 14 deletions
|
@ -520,7 +520,8 @@ defmodule Mobilizon.Events do
|
|||
|> events_for_tags(args)
|
||||
|> events_for_location(args)
|
||||
|> 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)
|
||||
end
|
||||
|
||||
|
@ -1339,21 +1340,12 @@ defmodule Mobilizon.Events do
|
|||
end
|
||||
|
||||
@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
|
||||
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,
|
||||
from(event in Event,
|
||||
join: id_and_rank in matching_event_ids_and_ranks(search_string),
|
||||
on: id_and_rank.id == event.id,
|
||||
order_by: [desc: id_and_rank.rank]
|
||||
on: id_and_rank.id == event.id
|
||||
)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue