diff --git a/config/config.exs b/config/config.exs index 8cb7c203a..62899a68b 100644 --- a/config/config.exs +++ b/config/config.exs @@ -392,6 +392,9 @@ config :mobilizon, Mobilizon.Service.GlobalSearch.SearchMobilizon, config :mobilizon, Mobilizon.Service.AntiSpam, service: Mobilizon.Service.AntiSpam.Akismet +config :mobilizon, Mobilizon.Service.SiteMap, + path: System.get_env("MOBILIZON_SITEMAP_PATH", "/var/lib/mobilizon/sitemap") + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" diff --git a/config/dev.exs b/config/dev.exs index 71ecab2a7..ebecdb839 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -92,6 +92,9 @@ config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "uploads" config :mobilizon, :exports, path: "uploads/exports" +config :mobilizon, Mobilizon.Service.SiteMap, + path: System.get_env("MOBILIZON_SITEMAP_PATH", "priv/static") + config :tz_world, data_dir: "_build/dev/lib/tz_world/priv" config :mobilizon, :anonymous, diff --git a/config/test.exs b/config/test.exs index 38a71c467..525fe37df 100644 --- a/config/test.exs +++ b/config/test.exs @@ -62,6 +62,9 @@ config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "test/uploads" config :mobilizon, :exports, path: "test/uploads/exports" +config :mobilizon, Mobilizon.Service.SiteMap, + path: System.get_env("MOBILIZON_SITEMAP_PATH", "test/sitemap") + config :tz_world, data_dir: "_build/test/lib/tz_world/priv" config :tesla, Mobilizon.Service.HTTP.ActivityPub, diff --git a/docker/multiarch/Dockerfile b/docker/multiarch/Dockerfile index 80d6ae1e8..5c71643b2 100644 --- a/docker/multiarch/Dockerfile +++ b/docker/multiarch/Dockerfile @@ -1,4 +1,4 @@ -FROM elixir as build +FROM elixir:1.15 as build SHELL ["/bin/bash", "-c"] ENV MIX_ENV prod # ENV LANG en_US.UTF-8 @@ -12,7 +12,7 @@ ENV ERL_FLAGS=$ERL_FLAGS # Set the right versions ENV ELIXIR_VERSION latest ENV ERLANG_VERSION latest -ENV NODE_VERSION 16 +ENV NODE_VERSION 18 # Install system dependencies RUN apt-get update -yq && apt-get install -yq build-essential cmake postgresql-client git curl gnupg unzip exiftool webp imagemagick gifsicle diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index a77e01c88..7621bcdf1 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -10,7 +10,7 @@ RUN yarn install --network-timeout 100000 \ && yarn run build # Then, build the application binary -FROM elixir:1.14-alpine AS builder +FROM elixir:1.15-alpine AS builder # Fix qemu segfault on arm64 # See https://github.com/plausible/analytics/pull/2879 and https://github.com/erlang/otp/pull/6340 diff --git a/docker/production/docker-entrypoint.sh b/docker/production/docker-entrypoint.sh index 1d7a7a7f3..3bc6868aa 100755 --- a/docker/production/docker-entrypoint.sh +++ b/docker/production/docker-entrypoint.sh @@ -3,7 +3,7 @@ set -e echo "-- Waiting for database..." -while ! pg_isready -U ${MOBILIZON_DATABASE_USERNAME} -d postgres://${MOBILIZON_DATABASE_HOST}:5432/${MOBILIZON_DATABASE_DBNAME} -t 1; do +while ! pg_isready -U ${MOBILIZON_DATABASE_USERNAME} -d postgres://${MOBILIZON_DATABASE_HOST}:${MOBILIZON_DATABASE_PORT:-5432}/${MOBILIZON_DATABASE_DBNAME} -t 1; do sleep 1s done diff --git a/js/src/components/Editor/Mention.ts b/js/src/components/Editor/Mention.ts index b866df575..82c134d4b 100644 --- a/js/src/components/Editor/Mention.ts +++ b/js/src/components/Editor/Mention.ts @@ -2,37 +2,32 @@ import { SEARCH_PERSONS } from "@/graphql/search"; import { VueRenderer } from "@tiptap/vue-3"; import tippy from "tippy.js"; import MentionList from "./MentionList.vue"; -import { apolloClient } from "@/vue-apollo"; +import { apolloClient, waitApolloQuery } from "@/vue-apollo"; import { IPerson } from "@/types/actor"; import pDebounce from "p-debounce"; import { MentionOptions } from "@tiptap/extension-mention"; import { Editor } from "@tiptap/core"; import { provideApolloClient, useQuery } from "@vue/apollo-composable"; import { Paginate } from "@/types/paginate"; -import { onError } from "@apollo/client/link/error"; -const fetchItems = (query: string): Promise => { - return new Promise((resolve, reject) => { - const { onResult } = provideApolloClient(apolloClient)(() => { - return useQuery<{ searchPersons: Paginate }>( - SEARCH_PERSONS, - () => ({ - variables: { - searchText: query, - }, - }) - ); - }); - - onResult(({ data }) => { - resolve(data.searchPersons.elements); - }); - - onError(reject); - }); - - // // TipTap doesn't handle async for onFilter, hence the following line. - // return result.data.searchPersons.elements; +const fetchItems = async (query: string): Promise => { + try { + if (query === "") return []; + const res = await waitApolloQuery( + provideApolloClient(apolloClient)(() => { + return useQuery< + { searchPersons: Paginate }, + { searchText: string } + >(SEARCH_PERSONS, () => ({ + searchText: query, + })); + }) + ); + return res.data.searchPersons.elements; + } catch (e) { + console.error(e); + return []; + } }; const debouncedFetchItems = pDebounce(fetchItems, 200); @@ -68,6 +63,10 @@ const mentionOptions: MentionOptions = { editor: props.editor, }); + if (!props.clientRect) { + return; + } + popup = tippy("body", { getReferenceClientRect: props.clientRect, appendTo: () => document.body, @@ -86,6 +85,12 @@ const mentionOptions: MentionOptions = { }); }, onKeyDown(props: any) { + if (props.event.key === "Escape") { + popup[0].hide(); + + return true; + } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore return component.ref?.onKeyDown(props); diff --git a/js/src/components/Editor/MentionList.vue b/js/src/components/Editor/MentionList.vue index f22e16530..441cf881f 100644 --- a/js/src/components/Editor/MentionList.vue +++ b/js/src/components/Editor/MentionList.vue @@ -1,8 +1,8 @@