From dff0c82f17d15ebed01941b9a24f9e0ab8feb1df Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 22 Mar 2023 17:34:16 +0000 Subject: [PATCH 1/1] Avoid using raw html in translations for the issues index --- app/views/issues/index.html.erb | 10 +++++----- config/locales/en.yml | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 0b9336538..da00b5fea 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -61,13 +61,13 @@ <%= link_to reportable_title(issue.reportable), reportable_url(issue.reportable) %> <%= link_to issue.reported_user.display_name, user_path(issue.reported_user) if issue.reported_user %> + <% time_ago_tag = tag.abbr(time_ago_in_words(issue.updated_at, :scope => :"datetime.distance_in_words_ago"), + :title => l(issue.updated_at)) %> <% if issue.user_updated %> - <%= t ".last_updated_time_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)), - :time => time_ago_in_words(issue.updated_at, :scope => :"datetime.distance_in_words_ago"), - :title => l(issue.updated_at) %> + <%= t ".last_updated_time_ago_user_html", :user => link_to(issue.user_updated.display_name, user_path(issue.user_updated)), + :time_ago => time_ago_tag %> <% else %> - <%= t ".last_updated_time_html", :time => time_ago_in_words(issue.updated_at, :scope => :"datetime.distance_in_words_ago"), - :title => l(issue.updated_at) %> + <%= time_ago_tag %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ed58ef3f1..0a9ca9980 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1387,8 +1387,7 @@ en: status: Status reports: Reports last_updated: Last Updated - last_updated_time_html: "%{time}" - last_updated_time_user_html: "%{time} by %{user}" + last_updated_time_ago_user_html: "%{time_ago} by %{user}" link_to_reports: View Reports reports_count: one: "%{count} Report" -- 2.39.5