From bd6c96f73742101df842cf21574a3bbe0c1371e0 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 18 Oct 2024 03:19:37 -0400 Subject: [PATCH] Fix broken i18n in text welcome mailer tags area (#32571) --- app/helpers/application_helper.rb | 5 +++++ app/views/application/mailer/_hashtag.html.haml | 3 +-- app/views/user_mailer/welcome.text.erb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8f9a433d82..4caf0398fe 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -244,6 +244,11 @@ module ApplicationHelper tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options) end + def recent_tag_usage(tag) + people = tag.history.aggregate(2.days.ago.to_date..Time.zone.today).accounts + I18n.t 'user_mailer.welcome.hashtags_recent_count', people: number_with_delimiter(people), count: people + end + private def storage_host_var diff --git a/app/views/application/mailer/_hashtag.html.haml b/app/views/application/mailer/_hashtag.html.haml index b740ba31b9..0fe7117bc4 100644 --- a/app/views/application/mailer/_hashtag.html.haml +++ b/app/views/application/mailer/_hashtag.html.haml @@ -17,5 +17,4 @@ %span.email-mini-hashtag-img-span = image_tag full_asset_url(account.avatar.url), alt: '', width: 16, height: 16 %td - - people = hashtag.history.aggregate(2.days.ago.to_date..Time.zone.today).accounts - %p= t('user_mailer.welcome.hashtags_recent_count', people: number_with_delimiter(people), count: people) + %p= recent_tag_usage(hashtag) diff --git a/app/views/user_mailer/welcome.text.erb b/app/views/user_mailer/welcome.text.erb index d9da2997da..144d44b842 100644 --- a/app/views/user_mailer/welcome.text.erb +++ b/app/views/user_mailer/welcome.text.erb @@ -53,7 +53,7 @@ <%= t('user_mailer.welcome.hashtags_subtitle') %> <%- @tags.each do |tag| %> -* #<%= tag.display_name %> · <%= t('user_mailer.welcome.hashtags_recent_count', people: number_with_delimiter(tag.history.aggregate(2.days.ago.to_date..Time.zone.today).accounts)) %> +* #<%= tag.display_name %> · <%= recent_tag_usage(tag) %> <%= tag_url(tag) %> <%- end %>