From eb72248e16b03ce3a87876e1b7b0d96965d648c6 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 11:39:01 +0100 Subject: [PATCH 1/8] Revert "fix search results sorted by id instead of by begins_on" This reverts commit a133612d9fa3dc6026fbcd07f9f452352f36ae0b. --- lib/mobilizon/events/events.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index 916efc708..9d6792940 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -520,8 +520,7 @@ defmodule Mobilizon.Events do |> events_for_tags(args) |> events_for_location(args) |> filter_local_or_from_followed_instances_events() - |> filter_public_visibility() - |> event_order_begins_on_asc() + |> order_by([q], asc: q.id) |> Page.build_page(page, limit) end @@ -1342,6 +1341,8 @@ defmodule Mobilizon.Events do @spec events_for_search_query(String.t()) :: Ecto.Query.t() 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 From 7f7bf025e7bd86ec5f91afe57759c760baa1aaaf Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 11:52:37 +0100 Subject: [PATCH 2/8] Fix leftovers Signed-off-by: Thomas Citharel --- lib/mobilizon/events/events.ex | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex index 9d6792940..d601fb8ff 100644 --- a/lib/mobilizon/events/events.ex +++ b/lib/mobilizon/events/events.ex @@ -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 From 60facf409376e1309bf003c771e53398ddb90607 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 15:06:26 +0100 Subject: [PATCH 3/8] Fix Homepage no promoted events warning Signed-off-by: Thomas Citharel --- js/src/views/Home.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/src/views/Home.vue b/js/src/views/Home.vue index 482172935..1a8a27520 100644 --- a/js/src/views/Home.vue +++ b/js/src/views/Home.vue @@ -261,10 +261,12 @@ {{ $t("No events found") }}
- - {{ - $t("The events you created are not shown here.") - }} +
+ + {{ + $t("The events you created are not shown here.") + }} +
From a5416aae5cdc26e5a8f61328ec7b2ee7e80bc9e4 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 15:06:48 +0100 Subject: [PATCH 4/8] Fix federation notification text email template Signed-off-by: Thomas Citharel --- lib/web/templates/email/instance_follow.text.eex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/templates/email/instance_follow.text.eex b/lib/web/templates/email/instance_follow.text.eex index 22c26f5d9..3e2809774 100644 --- a/lib/web/templates/email/instance_follow.text.eex +++ b/lib/web/templates/email/instance_follow.text.eex @@ -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" %> From eef4ea178d967d088701d5b30030576c3d6cde9e Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 15:07:59 +0100 Subject: [PATCH 5/8] [CI] Add back install into before_script: parts Because cache is really unreliable Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 01e949201..b587aff39 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,6 +50,8 @@ install: lint-elixir: stage: check + before_script: + - mix deps.get script: - export EXITVALUE=0 - mix credo --strict -a || export EXITVALUE=1 @@ -57,9 +59,11 @@ lint-elixir: - exit $EXITVALUE lint-front: + image: node:14 stage: check before_script: - export EXITVALUE=0 + - yarn --cwd "js" install --frozen-lockfile - cd js script: - yarn run lint || export EXITVALUE=1 @@ -68,10 +72,12 @@ lint-front: build-frontend: stage: build + 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: From 9f27a941a2fa1bb65484c0618427c59e6f61e72a Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 15:45:10 +0100 Subject: [PATCH 6/8] [CI] Remove cd js and use --cwd instead Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b587aff39..6af6d0ef7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,10 +64,9 @@ lint-front: before_script: - export EXITVALUE=0 - yarn --cwd "js" install --frozen-lockfile - - cd js 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: From 3c441306eb7d423b061e41d8e6b29429f26d9ae9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 15:47:12 +0100 Subject: [PATCH 7/8] Renable Mix docs job Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6af6d0ef7..31bc2dbb1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -156,14 +156,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: From 2734cae4b79e0d118705c72a8fd1d7c8aa516ed9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 14 Jan 2021 15:47:35 +0100 Subject: [PATCH 8/8] Rename stages Signed-off-by: Thomas Citharel --- .gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 31bc2dbb1..a66d55db4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,8 +3,9 @@ image: tcitworld/mobilizon-ci stages: - install - check - - build + - build-js - test + - docker - package - upload - deploy @@ -70,7 +71,7 @@ lint-front: - exit $EXITVALUE build-frontend: - stage: build + stage: build-js image: node:14 before_script: - apt update @@ -172,7 +173,7 @@ pages: # - public .docker: &docker - stage: build + stage: docker cache: {} image: name: gcr.io/kaniko-project/executor:debug