mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Custom unsubscribe options (#17090)
With this change, plugins can create custom unsubscribe keys, extend the unsubscribe view with custom preferences, and decide how they are updated.
This commit is contained in:
@@ -4,7 +4,7 @@ class SubscriptionMailer < ActionMailer::Base
|
||||
include Email::BuildEmailHelper
|
||||
|
||||
def confirm_unsubscribe(user, opts = {})
|
||||
unsubscribe_key = UnsubscribeKey.create_key_for(user, "all")
|
||||
unsubscribe_key = UnsubscribeKey.create_key_for(user, UnsubscribeKey::ALL_TYPE)
|
||||
build_email user.email,
|
||||
template: "unsubscribe_mailer",
|
||||
site_title: SiteSetting.title,
|
||||
|
||||
@@ -216,6 +216,8 @@ class UserNotifications < ActionMailer::Base
|
||||
|
||||
def digest(user, opts = {})
|
||||
build_summary_for(user)
|
||||
@unsubscribe_key = UnsubscribeKey.create_key_for(@user, UnsubscribeKey::DIGEST_TYPE)
|
||||
|
||||
min_date = opts[:since] || user.last_emailed_at || user.last_seen_at || 1.month.ago
|
||||
|
||||
# Fetch some topics and posts to show
|
||||
@@ -753,7 +755,6 @@ class UserNotifications < ActionMailer::Base
|
||||
@header_bgcolor = ColorScheme.hex_for_name('header_background')
|
||||
@anchor_color = ColorScheme.hex_for_name('tertiary')
|
||||
@markdown_linker = MarkdownLinker.new(@base_url)
|
||||
@unsubscribe_key = UnsubscribeKey.create_key_for(@user, "digest")
|
||||
@disable_email_custom_styles = !SiteSetting.apply_custom_styles_to_digest
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user