diff --git a/app/javascript/images/mailer/icon_add.png b/app/javascript/images/mailer/icon_add.png new file mode 100644 index 0000000000..93263cffd8 Binary files /dev/null and b/app/javascript/images/mailer/icon_add.png differ diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 5eecfed104..737ce9d418 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -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) } @@ -38,6 +38,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? diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index 55543ee303..e85dbdd35d 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -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 diff --git a/app/views/notification_mailer/reaction.html.haml b/app/views/notification_mailer/reaction.html.haml new file mode 100644 index 0000000000..83ae41927d --- /dev/null +++ b/app/views/notification_mailer/reaction.html.haml @@ -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' diff --git a/app/views/notification_mailer/reaction.text.erb b/app/views/notification_mailer/reaction.text.erb new file mode 100644 index 0000000000..fa30d708ea --- /dev/null +++ b/app/views/notification_mailer/reaction.text.erb @@ -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 %> diff --git a/app/views/settings/preferences/notifications/show.html.haml b/app/views/settings/preferences/notifications/show.html.haml index e0cbe36d1e..11b3c6a947 100644 --- a/app/views/settings/preferences/notifications/show.html.haml +++ b/app/views/settings/preferences/notifications/show.html.haml @@ -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 diff --git a/config/locales-glitch/simple_form.en.yml b/config/locales-glitch/simple_form.en.yml index 9de3f945ce..a9361bf192 100644 --- a/config/locales-glitch/simple_form.en.yml +++ b/config/locales-glitch/simple_form.en.yml @@ -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