Skip to content

Commit

Permalink
Fix broken i18n in text welcome mailer tags area (mastodon#32571)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjankowski authored Oct 18, 2024
1 parent 8b56509 commit bd6c96f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ def copyable_input(options = {})
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
Expand Down
3 changes: 1 addition & 2 deletions app/views/application/mailer/_hashtag.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion app/views/user_mailer/welcome.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down

0 comments on commit bd6c96f

Please sign in to comment.