Fix mailers for post and comment notifications (#293)

This commit is contained in:
Riccardo Graziosi
2024-02-24 19:18:55 +01:00
committed by GitHub
parent 1d6c5fd947
commit 7966e80421
3 changed files with 16 additions and 16 deletions

View File

@@ -9,7 +9,7 @@ class UserMailer < ApplicationMailer
mail(
to: @user.email,
subject: default_i18n_subject(app_name: app_name, post: comment.post.title)
subject: t('mailers.user.notify_post_owner.subject', site_name: site_name, post: comment.post.title)
)
end
@@ -21,7 +21,7 @@ class UserMailer < ApplicationMailer
mail(
to: @user.email,
subject: default_i18n_subject(app_name: app_name, post: comment.post.title)
subject: t('mailers.user.notify_comment_owner.subject', site_name: site_name, post: comment.post.title)
)
end
@@ -32,7 +32,7 @@ class UserMailer < ApplicationMailer
mail(
to: comment.post.followers.pluck(:email),
subject: default_i18n_subject(app_name: app_name, post: comment.post.title)
subject: t('mailers.user.notify_followers_of_post_update.subject', site_name: site_name, post: comment.post.title)
)
end
@@ -43,13 +43,13 @@ class UserMailer < ApplicationMailer
mail(
to: post.followers.pluck(:email),
subject: default_i18n_subject(app_name: app_name, post: post.title)
subject: t('mailers.user.notify_followers_of_post_status_change.subject', site_name: site_name, post: post.title)
)
end
private
def app_name
def site_name
Current.tenant_or_raise!.site_name
end
end

View File

@@ -1,7 +1,7 @@
<p>
<%= t('mailers.user.notify_followers_of_post_status_change.body', post: @post) %>
<span style='background-color: <%= @post.post_status.color %>; color: white;'%>>
<%= @post.post_status.name %>
<%= t('mailers.user.notify_followers_of_post_status_change.body', post: @post.title) %>
<span style='color: white; border-radius: 10rem; padding: 0.5rem; background-color: <%= @post.post_status.color %>;'>
<%= @post.post_status.name.upcase %>
</span>
</p>

View File

@@ -35,17 +35,17 @@ en:
learn_more: 'Click here to learn more'
unsubscribe: 'Annoyed? You can turn off notifications here'
notify_post_owner:
subject: '[%{app_name}] New comment on %{post}'
body: 'There is a new comment by %{user} on your post %{post}'
subject: '[%{site_name}] New comment on "%{post}"'
body: 'There is a new comment by "%{user}" on your post "%{post}"'
notify_comment_owner:
subject: '[%{app_name}] New reply on your comment from %{post}'
body: 'There is a new reply by %{user} on your comment from post %{post}'
subject: '[%{site_name}] New reply on your comment on post "%{post}"'
body: 'There is a new reply by "%{user}" on your comment from post "%{post}"'
notify_followers_of_post_update:
subject: '[%{app_name}] New update for post %{post}'
body: "There is a new update on the post you're following %{post}"
subject: '[%{site_name}] New update for post "%{post}"'
body: 'There is a new update on the post you are following "%{post}"'
notify_followers_of_post_status_change:
subject: '[%{app_name}] Status change on post %{post}'
body: "The post you're following %{post} has a new status"
subject: '[%{site_name}] Status change on post "%{post}"'
body: 'There is a status update on the post you are following "%{post}"'
activerecord:
models:
board: