Add notification emails for reactions
This commit is contained in:
parent
227a8d71b3
commit
14c0e46ef4
7 changed files with 64 additions and 2 deletions
BIN
app/javascript/images/mailer/icon_add.png
Normal file
BIN
app/javascript/images/mailer/icon_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -6,8 +6,8 @@ class NotificationMailer < ApplicationMailer
|
|||
:routing
|
||||
|
||||
before_action :process_params
|
||||
before_action :set_status, only: [:mention, :favourite, :reblog]
|
||||
before_action :set_account, only: [:follow, :favourite, :reblog, :follow_request]
|
||||
before_action :set_status, only: [:mention, :favourite, :reaction, :reblog]
|
||||
before_action :set_account, only: [:follow, :favourite, :reaction, :reblog, :follow_request]
|
||||
after_action :set_list_headers!
|
||||
|
||||
default to: -> { email_address_with_name(@user.email, @me.username) }
|
||||
|
@ -40,6 +40,15 @@ class NotificationMailer < ApplicationMailer
|
|||
end
|
||||
end
|
||||
|
||||
def reaction
|
||||
return unless @user.functional? && @status.present?
|
||||
|
||||
locale_for_account(@me) do
|
||||
thread_by_conversation(@status.conversation)
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
end
|
||||
|
||||
def reblog
|
||||
return unless @user.functional? && @status.present?
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ class UserSettings
|
|||
setting :follow, default: true
|
||||
setting :reblog, default: false
|
||||
setting :favourite, default: false
|
||||
setting :reaction, default: false
|
||||
setting :mention, default: true
|
||||
setting :follow_request, default: true
|
||||
setting :report, default: true
|
||||
|
|
45
app/views/notification_mailer/reaction.html.haml
Normal file
45
app/views/notification_mailer/reaction.html.haml
Normal file
|
@ -0,0 +1,45 @@
|
|||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.email-body
|
||||
.email-container
|
||||
%table.content-section{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.content-cell.hero
|
||||
.email-row
|
||||
.col-6
|
||||
%table.column{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.column-cell.text-center.padded
|
||||
%table.hero-icon{ align: 'center', cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td
|
||||
= image_tag full_pack_url('media/images/mailer/icon_add.png'), alt: ''
|
||||
|
||||
%h1= t 'notification_mailer.reaction.title'
|
||||
%p.lead= t('notification_mailer.reaction.body', name: @account.pretty_acct)
|
||||
|
||||
= render 'status', status: @status, time_zone: @me.user_time_zone
|
||||
|
||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.email-body
|
||||
.email-container
|
||||
%table.content-section{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.content-cell.content-start.border-top
|
||||
%table.column{ cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.column-cell.button-cell
|
||||
%table.button{ align: 'center', cellspacing: 0, cellpadding: 0 }
|
||||
%tbody
|
||||
%tr
|
||||
%td.button-primary
|
||||
= link_to web_url("@#{@status.account.pretty_acct}/#{@status.id}") do
|
||||
%span= t 'application_mailer.view_status'
|
5
app/views/notification_mailer/reaction.text.erb
Normal file
5
app/views/notification_mailer/reaction.text.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<%= raw t('application_mailer.salutation', name: display_name(@me)) %>
|
||||
|
||||
<%= raw t('notification_mailer.reaction.body', name: @account.pretty_acct) %>
|
||||
|
||||
<%= render 'status', status: @status %>
|
|
@ -17,6 +17,7 @@
|
|||
= ff.input :'notification_emails.follow_request', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.follow_request')
|
||||
= ff.input :'notification_emails.reblog', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.reblog')
|
||||
= ff.input :'notification_emails.favourite', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.favourite')
|
||||
= ff.input :'notification_emails.reaction', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.reaction')
|
||||
= ff.input :'notification_emails.mention', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.mention')
|
||||
|
||||
.fields-group
|
||||
|
|
|
@ -22,6 +22,7 @@ en:
|
|||
setting_system_emoji_font: Use system's default font for emojis (applies to Glitch flavour only)
|
||||
setting_visible_reactions: Number of visible emoji reactions
|
||||
notification_emails:
|
||||
reaction: Someone reacted to your post
|
||||
trending_link: New trending link requires review
|
||||
trending_status: New trending post requires review
|
||||
trending_tag: New trending tag requires review
|
||||
|
|
Loading…
Reference in a new issue