diff --git a/lib/clacks_web/templates/frontend/_follow_notification.html.eex b/lib/clacks_web/templates/frontend/_follow_notification.html.eex index 2a05c76..e950e35 100644 --- a/lib/clacks_web/templates/frontend/_follow_notification.html.eex +++ b/lib/clacks_web/templates/frontend/_follow_notification.html.eex @@ -4,7 +4,7 @@ Followed by <%= @actor.data["preferredUsername"] %>
- +
diff --git a/lib/clacks_web/views/frontend_view.ex b/lib/clacks_web/views/frontend_view.ex index f2b01b8..b7e4c82 100644 --- a/lib/clacks_web/views/frontend_view.ex +++ b/lib/clacks_web/views/frontend_view.ex @@ -35,13 +35,20 @@ defmodule ClacksWeb.FrontendView do def local_actor_link(%Actor{local: false, id: id}), do: Routes.frontend_path(Endpoint, :actor, id) - @spec display_timestamp(datetime :: String.t() | DateTime.t() | NaiveDateTime.t()) :: String.t() + @spec display_timestamp( + datetime :: String.t() | DateTime.t() | NaiveDateTime.t() | Activity.t() + ) :: String.t() def display_timestamp(str) when is_binary(str) do display_timestamp(Timex.parse!(str, "{ISO:Extended}")) end - def display_timestamp(datetime) do + def display_timestamp(%Activity{data: data, inserted_at: inserted_at}) do + display_timestamp(Map.get(data, "published", inserted_at)) + end + + def display_timestamp(%{__struct__: struct} = datetime) + when struct == DateTime or struct == NaiveDateTime do diff = Timex.diff(Timex.now(), datetime, :seconds) cond do