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( mail(
to: @user.email, 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 end
@@ -21,7 +21,7 @@ class UserMailer < ApplicationMailer
mail( mail(
to: @user.email, 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 end
@@ -32,7 +32,7 @@ class UserMailer < ApplicationMailer
mail( mail(
to: comment.post.followers.pluck(:email), 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 end
@@ -43,13 +43,13 @@ class UserMailer < ApplicationMailer
mail( mail(
to: post.followers.pluck(:email), 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 end
private private
def app_name def site_name
Current.tenant_or_raise!.site_name Current.tenant_or_raise!.site_name
end end
end end

View File

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

View File

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