From 8761556bac75e9f131d25ebd776a02202527b977 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 27 Oct 2022 17:05:59 +0200 Subject: [PATCH 1/4] Add logging for when cached iCalendar feed data can't be found Signed-off-by: Thomas Citharel --- lib/web/controllers/feed_controller.ex | 29 ++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/web/controllers/feed_controller.ex b/lib/web/controllers/feed_controller.ex index 8e8e2b221..7b103f7c3 100644 --- a/lib/web/controllers/feed_controller.ex +++ b/lib/web/controllers/feed_controller.ex @@ -6,6 +6,7 @@ defmodule Mobilizon.Web.FeedController do plug(:put_layout, false) action_fallback(Mobilizon.Web.FallbackController) alias Mobilizon.Config + require Logger @spec instance(Plug.Conn.t(), map()) :: Plug.Conn.t() def instance(conn, %{"format" => format}) do @@ -45,8 +46,8 @@ defmodule Mobilizon.Web.FeedController do @spec return_data(Plug.Conn.t(), String.t(), String.t(), String.t()) :: Plug.Conn.t() | {:error, :not_found} - defp return_data(conn, "atom", type, filename) do - case Cachex.fetch(:feed, type) do + defp return_data(conn, "atom", key, filename) do + case Cachex.fetch(:feed, key) do {status, data} when status in [:commit, :ok] -> conn |> put_resp_content_type("application/atom+xml") @@ -56,13 +57,21 @@ defmodule Mobilizon.Web.FeedController do ) |> send_resp(200, data) - _err -> + # No need to log these two + {:ignore, :actor_not_found} -> + {:error, :not_found} + + {:ignore, :actor_not_public} -> + {:error, :not_found} + + err -> + Logger.warn("Unable to find feed data cached for key #{key}, returned #{inspect(err)}") {:error, :not_found} end end - defp return_data(conn, "ics", type, filename) do - case Cachex.fetch(:ics, type) do + defp return_data(conn, "ics", key, filename) do + case Cachex.fetch(:ics, key) do {status, data} when status in [:commit, :ok] -> conn |> put_resp_content_type("text/calendar") @@ -72,7 +81,15 @@ defmodule Mobilizon.Web.FeedController do ) |> send_resp(200, data) - _ -> + # No need to log these two + {:ignore, :actor_not_found} -> + {:error, :not_found} + + {:ignore, :actor_not_public} -> + {:error, :not_found} + + err -> + Logger.warn("Unable to find feed data cached for key #{key}, returned #{inspect(err)}") {:error, :not_found} end end From 0bc48560e81f657d35a426ee6c15c4e2ef1fb2fa Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 27 Oct 2022 18:01:26 +0200 Subject: [PATCH 2/4] Fix group order Closes #1164 Signed-off-by: Thomas Citharel --- .../Event/GroupedMultiEventMinimalistCard.vue | 42 ++++----- js/src/graphql/event.ts | 2 +- js/src/views/Event/GroupEvents.vue | 93 +++++++++++++------ 3 files changed, 81 insertions(+), 56 deletions(-) diff --git a/js/src/components/Event/GroupedMultiEventMinimalistCard.vue b/js/src/components/Event/GroupedMultiEventMinimalistCard.vue index 01a90c6d2..bdb173b5f 100644 --- a/js/src/components/Event/GroupedMultiEventMinimalistCard.vue +++ b/js/src/components/Event/GroupedMultiEventMinimalistCard.vue @@ -1,7 +1,7 @@