From d1cf869744280cac280e1ad314ace0109eb2fb56 Mon Sep 17 00:00:00 2001 From: Earlopain Date: Tue, 16 May 2023 21:14:57 +0200 Subject: [PATCH] [Cleanup] Unify timestamp generation --- app/views/admin/exceptions/index.html.erb | 2 +- app/views/admin/exceptions/show.html.erb | 2 +- app/views/edit_histories/index.html.erb | 2 +- app/views/edit_histories/show.html.erb | 2 +- app/views/news_updates/_notice.erb | 2 +- app/views/post_report_reasons/index.html.erb | 2 +- app/views/post_sets/show.html.erb | 14 ++++++-------- app/views/takedowns/show.html.erb | 4 ++-- app/views/tickets/new_types/_blip.html.erb | 2 +- app/views/tickets/new_types/_comment.html.erb | 2 +- app/views/tickets/new_types/_dmail.html.erb | 3 +-- app/views/tickets/new_types/_forum.html.erb | 2 +- app/views/tickets/new_types/_pool.html.erb | 4 +--- app/views/tickets/new_types/_set.html.erb | 2 +- app/views/tickets/new_types/_wiki.html.erb | 2 +- app/views/user_votes/_common_index.html.erb | 8 ++++---- app/views/wiki_pages/index.html.erb | 2 +- 17 files changed, 26 insertions(+), 31 deletions(-) diff --git a/app/views/admin/exceptions/index.html.erb b/app/views/admin/exceptions/index.html.erb index 5ee016c49..0b87deb4e 100644 --- a/app/views/admin/exceptions/index.html.erb +++ b/app/views/admin/exceptions/index.html.erb @@ -18,7 +18,7 @@ <% @exception_logs.each do |exception_log| %> - <%= exception_log.created_at.strftime("%b %d, %Y %l:%M %p") %> + <%= compact_time exception_log.created_at %> <%= exception_log.code %> <%= link_to exception_log.version, GitHelper.commit_url(exception_log.version) %> <%= exception_log.extra_params.dig("params", "controller") %>/<%= exception_log.extra_params.dig("params", "action") %> diff --git a/app/views/admin/exceptions/show.html.erb b/app/views/admin/exceptions/show.html.erb index a46783132..a2e155322 100644 --- a/app/views/admin/exceptions/show.html.erb +++ b/app/views/admin/exceptions/show.html.erb @@ -5,7 +5,7 @@
Error Code: <%= @exception_log.code %>
- Created At: <%= @exception_log.created_at.strftime("%b %d, %Y %l:%M %p") %>
+ Created At: <%= compact_time @exception_log.created_at %>
Commit: <%= @exception_log.version %>
IP Address: <%= link_to_ip @exception_log.ip_addr %>
User: <%= link_to_user @exception_log.user %> diff --git a/app/views/edit_histories/index.html.erb b/app/views/edit_histories/index.html.erb index 15397d809..bc6b7ba26 100644 --- a/app/views/edit_histories/index.html.erb +++ b/app/views/edit_histories/index.html.erb @@ -22,7 +22,7 @@ <%= link_to "Show", action: "show", id: edit.versionable_id, type: edit.versionable_type %> <%= edit.versionable_type %> - <%= edit.updated_at.strftime("%b %d, %Y %I:%M %p") %> + <%= compact_time edit.updated_at %> <% if CurrentUser.is_admin? %> <%= link_to_ip edit.ip_addr %> <% end %> diff --git a/app/views/edit_histories/show.html.erb b/app/views/edit_histories/show.html.erb index 32bea49f9..e92f42066 100644 --- a/app/views/edit_histories/show.html.erb +++ b/app/views/edit_histories/show.html.erb @@ -7,7 +7,7 @@
<%= link_to_user edit.user %>
- "><%= edit.created_at.strftime("%b %d, %Y %I:%M %p") %> + <%= compact_time edit.created_at %> <% if CurrentUser.is_admin? %>
<%= link_to_ip edit.ip_addr %>
<% end %> diff --git a/app/views/news_updates/_notice.erb b/app/views/news_updates/_notice.erb index f46357c11..d830c2910 100644 --- a/app/views/news_updates/_notice.erb +++ b/app/views/news_updates/_notice.erb @@ -2,7 +2,7 @@ -
Short - Name: <%= link_to @post_set.shortname, posts_path(tags: "set:#{@post_set.shortname}") %>
- Created: - "><%= time_ago_in_words(@post_set.created_at) + " ago" %> - | - Updated: - "><%= time_ago_in_words(@post_set.updated_at) + " ago" %>

- +
+ Short Name: <%= link_to @post_set.shortname, posts_path(tags: "set:#{@post_set.shortname}") %> +
+ Created: <%= time_ago_in_words_tagged(@post_set.created_at) %> | + Updated: <%= time_ago_in_words_tagged(@post_set.updated_at) %> +

<% if @post_set.description.blank? %>
No description.
<% else %> diff --git a/app/views/takedowns/show.html.erb b/app/views/takedowns/show.html.erb index b4027aeac..b712a6cd4 100644 --- a/app/views/takedowns/show.html.erb +++ b/app/views/takedowns/show.html.erb @@ -76,13 +76,13 @@ - "><%= time_ago_in_words(@takedown.created_at) %> ago + <%= time_ago_in_words_tagged(@takedown.created_at) %> <% if @takedown.created_at != @takedown.updated_at %> - "><%= time_ago_in_words(@takedown.updated_at) %> ago + <%= time_ago_in_words_tagged(@takedown.updated_at) %> <% end %> diff --git a/app/views/tickets/new_types/_blip.html.erb b/app/views/tickets/new_types/_blip.html.erb index eb2f63dfe..945d752ba 100644 --- a/app/views/tickets/new_types/_blip.html.erb +++ b/app/views/tickets/new_types/_blip.html.erb @@ -1,7 +1,7 @@ <% @blip = @ticket.content %>

You are reporting the following blip:

<%= link_to_user(@blip.creator) %>
-"><%= time_ago_in_words(@blip.created_at) %> ago +<%= time_ago_in_words_tagged(@blip.created_at) %>

<%= format_text(@blip.body) %> diff --git a/app/views/tickets/new_types/_comment.html.erb b/app/views/tickets/new_types/_comment.html.erb index 673196a75..675648371 100644 --- a/app/views/tickets/new_types/_comment.html.erb +++ b/app/views/tickets/new_types/_comment.html.erb @@ -1,7 +1,7 @@ <% @comment = @ticket.content %>

You are reporting the following comment:

<%= link_to_user @comment.creator %>
-"><%= time_ago_in_words(@comment.created_at) %> ago +<%= time_ago_in_words_tagged(@comment.created_at) %>

<%= format_text(@comment.body) %> diff --git a/app/views/tickets/new_types/_dmail.html.erb b/app/views/tickets/new_types/_dmail.html.erb index a9879db97..ab2ab79bb 100644 --- a/app/views/tickets/new_types/_dmail.html.erb +++ b/app/views/tickets/new_types/_dmail.html.erb @@ -1,8 +1,7 @@ <% @dmail = @ticket.content %>

You are reporting the following private message:

<%= link_to_user @dmail.from %>
-"><%= time_ago_in_words(@dmail.created_at) %> - ago +<%= time_ago_in_words_tagged(@dmail.created_at) %>

<%= format_text(@dmail.body) %> diff --git a/app/views/tickets/new_types/_forum.html.erb b/app/views/tickets/new_types/_forum.html.erb index aa96f5354..e1840a256 100644 --- a/app/views/tickets/new_types/_forum.html.erb +++ b/app/views/tickets/new_types/_forum.html.erb @@ -1,7 +1,7 @@ <% @forum = @ticket.content %>

You are reporting the following forum post:

<%= link_to_user(@forum.creator) %>
-"><%= time_ago_in_words(@forum.created_at) %> ago +<%= time_ago_in_words_tagged(@forum.created_at) %>

<%= format_text(@forum.body) %> diff --git a/app/views/tickets/new_types/_pool.html.erb b/app/views/tickets/new_types/_pool.html.erb index ed31531ab..4ed9a1aea 100644 --- a/app/views/tickets/new_types/_pool.html.erb +++ b/app/views/tickets/new_types/_pool.html.erb @@ -2,6 +2,4 @@

You are reporting the following pool:

<%= link_to(@pool.name, pool_path(@pool)) %>
<%= link_to_user(@pool.creator) %>
-"> - <%= time_ago_in_words(@pool.created_at) %> ago - +<%= time_ago_in_words_tagged(@pool.created_at) %> diff --git a/app/views/tickets/new_types/_set.html.erb b/app/views/tickets/new_types/_set.html.erb index f581e5500..706a0c82f 100644 --- a/app/views/tickets/new_types/_set.html.erb +++ b/app/views/tickets/new_types/_set.html.erb @@ -2,4 +2,4 @@

You are reporting the following set:

<%= link_to(@set.name, post_set_path(@set)) %>
<%= link_to_user(@set.creator) %>
-"><%= time_ago_in_words(@set.created_at) %> ago +<%= time_ago_in_words_tagged(@set.created_at) %> diff --git a/app/views/tickets/new_types/_wiki.html.erb b/app/views/tickets/new_types/_wiki.html.erb index eef6f5d0b..8d68f5ace 100644 --- a/app/views/tickets/new_types/_wiki.html.erb +++ b/app/views/tickets/new_types/_wiki.html.erb @@ -1,7 +1,7 @@ <% @wiki = @ticket.content %>

You are reporting the following wiki page:

<%= link_to_wiki @wiki.title %>
-"><%= time_ago_in_words(@wiki.created_at) %> ago +<%= time_ago_in_words_tagged(@wiki.created_at) %>

<%= format_text(@wiki.body) %> diff --git a/app/views/user_votes/_common_index.html.erb b/app/views/user_votes/_common_index.html.erb index 3aaab3aa6..3c0a89d5e 100644 --- a/app/views/user_votes/_common_index.html.erb +++ b/app/views/user_votes/_common_index.html.erb @@ -41,16 +41,16 @@ <%= link_to_user vote.send(type.model_type).send(type.model_creator_column) %> <%= link_to_user vote.user %> <% if CurrentUser.is_admin? %> - <%= vote.user.email %> + <%= vote.user.email %> <% end %> - "><%= time_ago_in_words(vote.user.created_at) %> ago + <%= time_ago_in_words_tagged(vote.user.created_at) %> <% if vote.is_positive? %>Up <% elsif vote.is_locked? %>Locked <% else %>Down - <% end %> - "><%= time_ago_in_words(vote.created_at) %> ago + <% end %> + <%= time_ago_in_words_tagged(vote.created_at) %> <% if CurrentUser.is_admin? %> <%= link_to_ip vote.user_ip_addr %> <% end %> diff --git a/app/views/wiki_pages/index.html.erb b/app/views/wiki_pages/index.html.erb index 6dda2a3fc..8ffdfa06b 100644 --- a/app/views/wiki_pages/index.html.erb +++ b/app/views/wiki_pages/index.html.erb @@ -18,7 +18,7 @@ <% @wiki_pages.each do |wiki_page| %> <%= link_to wiki_page.pretty_title, wiki_page_path(wiki_page) %> - <%= wiki_page.updated_at.strftime("%Y-%m-%d %H:%M") %> by <%= h link_to_user wiki_page.updater %> + <%= compact_time wiki_page.updated_at %> by <%= link_to_user wiki_page.updater %> <%= link_to "History", wiki_page_versions_path(search: { wiki_page_id: wiki_page.id }) %> <% end %>