mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 08:38:06 +01:00
Add notification emails for reactions
This commit is contained in:
parent
b275f1aa77
commit
87faa54726
7 changed files with 63 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,11 +6,11 @@ class NotificationMailer < ApplicationMailer
|
|||
:routing
|
||||
|
||||
before_action :process_params
|
||||
with_options only: %i(mention favourite reblog) do
|
||||
with_options only: %i(mention favourite reaction reblog) do
|
||||
before_action :set_status
|
||||
after_action :thread_by_conversation!
|
||||
end
|
||||
before_action :set_account, only: [:follow, :favourite, :reblog, :follow_request]
|
||||
before_action :set_account, only: [:follow, :favourite, :reaction, :reblog, :follow_request]
|
||||
after_action :set_list_headers!
|
||||
|
||||
before_deliver :verify_functional_user
|
||||
|
@ -41,6 +41,14 @@ class NotificationMailer < ApplicationMailer
|
|||
end
|
||||
end
|
||||
|
||||
def reaction
|
||||
return unless @user.functional? && @status.present?
|
||||
|
||||
locale_for_account(@me) do
|
||||
mail subject: default_i18n_subject(name: @account.acct)
|
||||
end
|
||||
end
|
||||
|
||||
def reblog
|
||||
return if @status.blank?
|
||||
|
||||
|
|
|
@ -45,6 +45,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