Merge branch 'setop-master-patch-94239' into 'master'

fix search results sorted by id instead of by begins_on

See merge request framasoft/mobilizon!784
This commit is contained in:
Thomas Citharel 2021-01-12 10:28:22 +01:00
commit baf9199234
1 changed files with 2 additions and 3 deletions

View File

@ -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
@ -1341,8 +1342,6 @@ defmodule Mobilizon.Events do
@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(search_string) do defp events_for_search_query(search_string) do
Event Event
|> where([e], e.visibility == ^:public)
|> distinct([e], e.id)
|> do_event_for_search_query(search_string) |> do_event_for_search_query(search_string)
end end