Merge branch 'fix-search-order' into 'master'

Fix search order

See merge request framasoft/mobilizon!790
This commit is contained in:
Thomas Citharel 2021-01-14 16:28:29 +01:00
commit 6cff21868e
4 changed files with 34 additions and 30 deletions

View file

@ -3,8 +3,9 @@ image: tcitworld/mobilizon-ci
stages:
- install
- check
- build
- build-js
- test
- docker
- package
- upload
- deploy
@ -50,6 +51,8 @@ install:
lint-elixir:
stage: check
before_script:
- mix deps.get
script:
- export EXITVALUE=0
- mix credo --strict -a || export EXITVALUE=1
@ -57,21 +60,24 @@ lint-elixir:
- exit $EXITVALUE
lint-front:
image: node:14
stage: check
before_script:
- export EXITVALUE=0
- cd js
- yarn --cwd "js" install --frozen-lockfile
script:
- yarn run lint || export EXITVALUE=1
- yarn run prettier -c . || export EXITVALUE=1
- yarn --cwd "js" run lint || export EXITVALUE=1
- yarn --cwd "js" run prettier -c . || export EXITVALUE=1
- exit $EXITVALUE
build-frontend:
stage: build
stage: build-js
image: node:14
before_script:
- apt update
- apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant
script:
- yarn --cwd "js" install --frozen-lockfile
- yarn --cwd "js" run build
artifacts:
expire_in: 5 days
@ -82,6 +88,8 @@ build-frontend:
deps:
stage: check
before_script:
- mix deps.get
script:
- export EXITVALUE=0
- mix hex.outdated || export EXITVALUE=1
@ -99,6 +107,7 @@ exunit:
variables:
MIX_ENV: test
before_script:
- mix deps.get
- mix ecto.create
- mix ecto.migrate
script:
@ -114,6 +123,8 @@ jest:
stage: test
needs:
- lint-front
before_script:
- yarn --cwd "js" install --frozen-lockfile
script:
- yarn --cwd "js" run test:unit --no-color --ci --reporters=default --reporters=jest-junit
artifacts:
@ -146,14 +157,12 @@ jest:
# - js/tests/e2e/screenshots/**/*.png
# - js/tests/e2e/videos/**/*.mp4
# pages:
# stage: deploy
# script:
# # - mkdir public
# # Mobilizon documentation is now on https://framagit.org/framasoft/joinmobilizon/documentation
# # Mix docs disabled because of https://github.com/elixir-lang/ex_doc/issues/1172
# # - mix docs
# # - mv doc public/backend
pages:
stage: deploy
script:
- mkdir public
- mix docs
- mv doc public/backend
# #- yarn run --cwd "js" styleguide:build
# #- mv js/styleguide public/frontend
# rules:
@ -164,7 +173,7 @@ jest:
# - public
.docker: &docker
stage: build
stage: docker
cache: {}
image:
name: gcr.io/kaniko-project/executor:debug

View file

@ -261,10 +261,12 @@
</div>
<b-message v-else type="is-danger"
>{{ $t("No events found") }}<br />
<div v-if="goingToEvents.size > 0 || lastWeekEvents.length > 0">
<b-icon size="is-small" icon="information-outline" />
<small v-if="goingToEvents.size > 0 || lastWeekEvents.length > 0">{{
<small>{{
$t("The events you created are not shown here.")
}}</small>
</div>
</b-message>
</section>
</div>

View file

@ -1340,19 +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
|> 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

View file

@ -2,6 +2,6 @@
==
<%= gettext "%{name} (%{domain}) just requested to follow your instance.", name: @follower.name, domain: @follower.domain %>
<%= gettext "If you accept, this instance will receive all of your public events." %>
<%= gettext "Note: %{name} (%{domain}) following you doesn't necessarily imply that you follow this instance, but you can ask to follow them too." %>
<%= gettext "Note: %{name} (%{domain}) following you doesn't necessarily imply that you follow this instance, but you can ask to follow them too.", name: @follower.name, domain: @follower.domain %>
<%= gettext "To accept this invitation, head over to the instance's admin settings." %>
<%= "#{Mobilizon.Web.Endpoint.url()}/settings/admin/relays/followers" %>