Add unsubscribe link to e-mails (#25378)

This commit is contained in:
Eugen Rochko 2023-06-12 14:22:46 +02:00 committed by GitHub
parent dfaf59d99a
commit 6637ef7852
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 106 additions and 11 deletions

View file

@ -44,7 +44,11 @@
%tbody
%td.column-cell
%p= t 'about.hosted_on', domain: site_hostname
%p= link_to t('application_mailer.notification_preferences'), settings_preferences_notifications_url
%p
= link_to t('application_mailer.notification_preferences'), settings_preferences_notifications_url
- if defined?(@type)
·
= link_to t('application_mailer.unsubscribe'), unsubscribe_url(token: @user.to_sgid(for: 'unsubscribe').to_s, type: @type)
%td.column-cell.text-right
= link_to root_url do
= image_tag full_pack_url('media/images/mailer/logo.png'), alt: 'Mastodon', height: 24

View file

@ -0,0 +1,9 @@
- content_for :page_title do
= t('mail_subscriptions.unsubscribe.title')
.simple_form
%h1.title= t('mail_subscriptions.unsubscribe.complete')
%p.lead
= t('mail_subscriptions.unsubscribe.success_html', domain: content_tag(:strong, site_hostname), type: content_tag(:strong, I18n.t(@type, scope: 'mail_subscriptions.unsubscribe.emails')), email: content_tag(:strong, @user.email))
%p.lead
= t('mail_subscriptions.unsubscribe.resubscribe_html', settings_path: settings_preferences_notifications_path)

View file

@ -0,0 +1,12 @@
- content_for :page_title do
= t('mail_subscriptions.unsubscribe.title')
.simple_form
%h1.title= t('mail_subscriptions.unsubscribe.title')
%p.lead
= t('mail_subscriptions.unsubscribe.confirmation_html', domain: content_tag(:strong, site_hostname), type: content_tag(:strong, I18n.t(@type, scope: 'mail_subscriptions.unsubscribe.emails')), email: content_tag(:strong, @user.email), settings_path: settings_preferences_notifications_path)
= form_tag unsubscribe_path, method: :post do
= hidden_field_tag :token, params[:token]
= hidden_field_tag :type, params[:type]
= button_tag t('mail_subscriptions.unsubscribe.action'), type: :submit