Skip to content

Commit

Permalink
Add timezone to datetimes in e-mails (mastodon#26822)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored and vmstan committed Jan 5, 2024
1 parent 8ca4e60 commit 820c690
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/views/admin_mailer/new_appeal.text.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= raw t('application_mailer.salutation', name: display_name(@me)) %>

<%= raw t('admin_mailer.new_appeal.body', target: @appeal.account.username, action_taken_by: @appeal.strike.account.username, date: l(@appeal.strike.created_at), type: t(@appeal.strike.action, scope: 'admin_mailer.new_appeal.actions')) %>
<%= raw t('admin_mailer.new_appeal.body', target: @appeal.account.username, action_taken_by: @appeal.strike.account.username, date: l(@appeal.strike.created_at, format: :with_time_zone), type: t(@appeal.strike.action, scope: 'admin_mailer.new_appeal.actions')) %>

> <%= raw word_wrap(@appeal.text, break_sequence: "\n> ") %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/notification_mailer/_status.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
= link_to a.remote_url, a.remote_url

%p.status-footer
= link_to l(status.created_at.in_time_zone(time_zone.presence)), web_url("@#{status.account.pretty_acct}/#{status.id}")
= link_to l(status.created_at.in_time_zone(time_zone.presence), format: :with_time_zone), web_url("@#{status.account.pretty_acct}/#{status.id}")
2 changes: 1 addition & 1 deletion app/views/user_mailer/appeal_approved.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
%tbody
%tr
%td.column-cell.text-center
%p= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence))
%p= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)

%table.email-table{ cellspacing: 0, cellpadding: 0 }
%tbody
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_mailer/appeal_approved.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

===

<%= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence)) %>
<%= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone) %>

=> <%= root_url %>
2 changes: 1 addition & 1 deletion app/views/user_mailer/appeal_rejected.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
%tbody
%tr
%td.column-cell.text-center
%p= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence))
%p= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)

%table.email-table{ cellspacing: 0, cellpadding: 0 }
%tbody
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_mailer/appeal_rejected.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

===

<%= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence)) %>
<%= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone.presence), format: :with_time_zone) %>

=> <%= root_url %>
2 changes: 1 addition & 1 deletion app/views/user_mailer/suspicious_sign_in.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
%strong= "#{t('sessions.browser')}:"
%span{ title: @user_agent }= t 'sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s), platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s)
%br/
= l(@timestamp.in_time_zone(@resource.time_zone.presence))
= l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone)

%table.email-table{ cellspacing: 0, cellpadding: 0 }
%tbody
Expand Down
2 changes: 1 addition & 1 deletion app/views/user_mailer/suspicious_sign_in.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<%= t('sessions.ip') %>: <%= @remote_ip %>
<%= t('sessions.browser') %>: <%= t('sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: "#{@detection.id}"), platform: t("sessions.platforms.#{@detection.platform.id}", default: "#{@detection.platform.id}")) %>
<%= l(@timestamp.in_time_zone(@resource.time_zone.presence)) %>
<%= l(@timestamp.in_time_zone(@resource.time_zone.presence), format: :with_time_zone) %>

<%= t 'user_mailer.suspicious_sign_in.further_actions_html', action: t('user_mailer.suspicious_sign_in.change_password') %>

Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1739,6 +1739,7 @@ en:
default: "%b %d, %Y, %H:%M"
month: "%b %Y"
time: "%H:%M"
with_time_zone: "%b %d, %Y, %H:%M %Z"
translation:
errors:
quota_exceeded: The server-wide usage quota for the translation service has been exceeded.
Expand Down

0 comments on commit 820c690

Please sign in to comment.