FIX: Use correct URL for unsubscribe (#10077)

This commit is contained in:
Bianca Nenciu 2020-06-24 10:31:20 +03:00 committed by GitHub
parent 9ffc022cf4
commit 75151f0457
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -9,6 +9,6 @@ class SubscriptionMailer < ActionMailer::Base
template: "unsubscribe_mailer",
site_title: SiteSetting.title,
site_domain_name: Discourse.current_hostname,
confirm_unsubscribe_link: "#{Discourse.base_url}/unsubscribe/#{unsubscribe_key}"
confirm_unsubscribe_link: email_unsubscribe_url(unsubscribe_key, host: Discourse.base_url)
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
require "rails_helper"
describe SubscriptionMailer do
fab!(:user) { Fabricate(:user) }
subject { SubscriptionMailer.confirm_unsubscribe(user) }
it "contains the right URL" do
expect(subject.body).to include("#{Discourse.base_url}/email/unsubscribe/#{UnsubscribeKey.last.key}")
end
end