From 926c021125fbd6e847a12c7d3acc0d738b2e80ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 13 Jul 2016 22:32:46 +0200 Subject: [PATCH] set 'List-Unsubscribe' email header to new unsubscribe url instead of user preferences url --- lib/email/message_builder.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/email/message_builder.rb b/lib/email/message_builder.rb index 79fe8a46b..4be0c89a4 100644 --- a/lib/email/message_builder.rb +++ b/lib/email/message_builder.rb @@ -132,10 +132,11 @@ module Email def header_args result = {} if @opts[:add_unsubscribe_link] - result['List-Unsubscribe'] = "<#{template_args[:user_preferences_url]}>" + unsubscribe_url = @template_args[:unsubscribe_url].presence || @template_args[:user_preferences_url] + result['List-Unsubscribe'] = "<#{unsubscribe_url}>" end - result['X-Discourse-Post-Id'] = @opts[:post_id].to_s if @opts[:post_id] + result['X-Discourse-Post-Id'] = @opts[:post_id].to_s if @opts[:post_id] result['X-Discourse-Topic-Id'] = @opts[:topic_id].to_s if @opts[:topic_id] if allow_reply_by_email?