diff --git a/lib/pleroma/web/static_fe/static_fe_view.ex b/lib/pleroma/web/static_fe/static_fe_view.ex index df5ff5628..c85689c8b 100644 --- a/lib/pleroma/web/static_fe/static_fe_view.ex +++ b/lib/pleroma/web/static_fe/static_fe_view.ex @@ -22,6 +22,35 @@ def fetch_media_type(%{"mediaType" => mediaType}) do Utils.fetch_media_type(@media_types, mediaType) end + def time_ago(date) do + {:ok, date, _} = DateTime.from_iso8601(date) + {:ok, now} = DateTime.now("Etc/UTC") + + years = now.year - date.year + months = now.month - date.month + days = now.day - date.day + hours = now.hour - date.hour + minutes = now.minute - date.minute + seconds = now.second - date.second + cond do + years > 1 -> to_string(years) <> " years ago" + years > 0 -> "1 year ago" + months > 1 -> to_string(months) <> " months ago" + months > 0 -> "1 month ago" + days > 13 -> to_string(trunc(days / 7)) <> " weeks ago" + days > 6 -> "1 week ago" + days > 1 -> to_string(days) <> " days ago" + days > 0 -> "1 day ago" + hours > 1 -> to_string(hours) <> " hours ago" + hours > 0 -> "1 hour ago" + minutes > 1 -> to_string(minutes) <> " minutes ago" + minutes > 0 -> "1 minute ago" + seconds > 1 -> to_string(seconds) <> " seconds ago" + seconds > 0 -> "1 second ago" + true -> "now" + end + end + def format_date(date) do {:ok, date, _} = DateTime.from_iso8601(date) Strftime.strftime!(date, "%Y/%m/%d %l:%M:%S %p UTC") @@ -32,7 +61,7 @@ def instance_name, do: Pleroma.Config.get([:instance, :name], "Akkoma") def open_content? do Pleroma.Config.get( [:frontend_configurations, :collapse_message_with_subjects], - true + false ) end end diff --git a/lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex b/lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex index df0244795..7393b7ee2 100644 --- a/lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex +++ b/lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex @@ -1,41 +1,66 @@ -
-
-
+<%= raw @title %>
- <%= Gettext.gettext("sensitive media") %>
-
-
- <% end %>
+
+ <%= raw Formatter.emojify(@user.name, @user.emoji) %>
+
+
+ <%= @user.nickname %>
+
+ Show content
+ <%= Gettext.gettext("sensitive media") %>
+ <%= link instance_name(), to: "/" %>
-