Add notification emails for reactions

This commit is contained in:
Essem 2023-11-10 15:16:29 -06:00
parent b275f1aa77
commit 87faa54726
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
7 changed files with 63 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -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?

View file

@ -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

View 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'

View 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 %>

View file

@ -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

View file

@ -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